PHPackages                             hedii/helpers - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hedii/helpers

AbandonedLibrary[Utility &amp; Helpers](/categories/utility)

hedii/helpers
=============

A collection of php helper functions

1.1.1(9y ago)41.3k1MITPHP &gt;=7.0

Since Sep 14Compare

[ Source](https://github.com/hedii/helpers)[ Packagist](https://packagist.org/packages/hedii/helpers)[ RSS](/packages/hedii-helpers/feed)WikiDiscussions Synced today

READMEChangelog (3)Dependencies (1)Versions (4)Used By (1)

[![Build Status](https://camo.githubusercontent.com/8e444ff818020bfa629712ec0ad8308d17fd60f33bc3233a92028728d817f626/68747470733a2f2f7472617669732d63692e6f72672f68656469692f68656c706572732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hedii/helpers)

Helpers
=======

[](#helpers)

A collection of php helper functions

Table of contents
-----------------

[](#table-of-contents)

- [Table of contents](#table-of-contents)
- [Installation](#installation)
- [Usage](#usage)
    - [Available functions](#available-functions)
    - [Functions description](#functions-description)
- [Testing](#testing)
- [License](#license)

Installation
------------

[](#installation)

Install via [composer](https://getcomposer.org/doc/00-intro.md)

```
composer require hedii/helpers
```

Usage
-----

[](#usage)

### Available functions

[](#available-functions)

- [string\_without](#string_without)
- [string\_before](#string_before)
- [string\_after](#string_after)
- [string\_between](#string_between)
- [string\_starts\_with](#string_starts_with)
- [string\_ends\_with](#string_ends_with)
- [string\_length](#string_length)
- [string\_is](#string_is)
- [string\_contains](#string_contains)
- [string\_finish](#string_finish)
- [string\_random](#string_random)
- [is\_url](#is_url)
- [class\_basename](#class_basename)
- [is\_windows\_os](#is_windows_os)

### Functions description

[](#functions-description)

#### `string_without(string $haystack, string $needle)`

[](#string_withoutstring-haystack-string-needle)

Remove a substring from a string. It returns the original string if the substring is not found.

```
$string = string_without('This is my name', ' is ');

// Thismy name

$string = string_without('This is my name', 'some string');

// This is my name
```

---

#### `string_before(string $haystack, string $needle)`

[](#string_beforestring-haystack-string-needle)

Get the string before a delimiter. It returns false if the string does not contains the delimiter.

```
$string = string_before('This is my name', ' name');

// This is my

$string = string_before('This is my name', 'some string');

// false
```

---

#### `string_after(string $haystack, string $needle)`

[](#string_afterstring-haystack-string-needle)

Get the string after a delimiter. It returns false if the string does not contains the delimiter.

```
$string = string_after('This is my name', 'This ');

// is my name

$string = string_after('This is my name', 'some string');

// false
```

---

#### `string_between(string $haystack, string $needle1, string $needle2)`

[](#string_betweenstring-haystack-string-needle1-string-needle2)

Get the string between two delimiters. It returns false if the string does not contains the two delimiters.

```
$string = string_between('This is my name', 'This ', ' name');

// is my

$string = string_between('This is my name', 'some', ' string');

// false
```

---

#### `string_starts_with(string $haystack, string|array $needles)`

[](#string_starts_withstring-haystack-stringarray-needles)

Determines if the given string begins with the given value.

```
$value = string_starts_with('This is my name', 'This');

// true
```

---

#### `string_ends_with(string $haystack, string|array $needles)`

[](#string_ends_withstring-haystack-stringarray-needles)

Determines if the given string ends with the given value.

```
$value = string_ends_with('This is my name', 'name');

// true
```

---

#### `string_length(string $string)`

[](#string_lengthstring-string)

Get the length of the given string.

```
$length = string_length('abcd');

// 4
```

---

#### `string_is(string $pattern, string $string)`

[](#string_isstring-pattern-string-string)

Determines if a given string matches a given pattern. Asterisks may be used to indicate wildcards.

```
$value = string_is('foo*', 'foobar');

// true

$value = string_is('baz*', 'foobar');

// false
```

---

#### `string_contains(string $haystack, string|array $needles)`

[](#string_containsstring-haystack-stringarray-needles)

Determines if the given string contains the given value.

```
$value = string_contains('This is my name', 'my');

// true

$value = string_contains('This is my name', ['some string', 'my']);

// true
```

---

#### `string_finish(string $string, string $cap)`

[](#string_finishstring-string-string-cap)

Adds a single instance of the given value to a string.

```
$string = string_finish('this/string', '/');

// this/string/

$string = string_finish('this/string/', '/');

// this/string/
```

---

#### `string_random(int $length = 32)`

[](#string_randomint-length--32)

Generates a random string of the specified length.

```
$string = string_random(40);

// 6a2531aabec1fda11b0e0d9eaeb17d7ebfe1cdc5
```

---

#### `is_url(string $string)`

[](#is_urlstring-string)

Determine if a string is a valid url.

```
is_url('http://example.com');

// true

is_url('tel:+1-111-222-333');

// false
```

---

#### `class_basename(string|object $class)`

[](#class_basenamestringobject-class)

Get the class "basename" of the given object / class.

```
$basename = class_basename(\Hedii\Helpers\HelpersTest);

// HelpersTest
```

---

#### `is_windows_os()`

[](#is_windows_os)

Determine whether the current environment is Windows based.

```
is_window_os();

// false
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

helpers is released under the MIT Licence. See the bundled [LICENSE](https://github.com/hedii/helpers/blob/master/LICENSE.md) file for details.

helpers contains some content from Laravel [illuminate/support](https://github.com/illuminate/support) package. See the [LARAVEL LICENSE](https://github.com/laravel/framework/blob/master/LICENSE.md) file for details.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity60

Established project with proven stability

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~10 days

Total

3

Last Release

3556d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e4a5db1cfc95de95128aba94b6f26a69d543e7f1e95f5f9afcdaf7e1db836fe1?d=identicon)[hedii](/maintainers/hedii)

---

Tags

phphelpershedii

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hedii-helpers/health.svg)

```
[![Health](https://phpackages.com/badges/hedii-helpers/health.svg)](https://phpackages.com/packages/hedii-helpers)
```

###  Alternatives

[hedii/laravel-date-range

A date range trait with local scope methods for Laravel Eloquent models

2140.6k](/packages/hedii-laravel-date-range)[transprime-research/piper

PHP Pipe method execution with values from chained method executions

174.6k2](/packages/transprime-research-piper)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
