PHPackages                             andrey-helldar/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. andrey-helldar/helpers

Abandoned → [andrey-helldar/support](/?search=andrey-helldar%2Fsupport)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

andrey-helldar/helpers
======================

Helpers that simplify the development process

1.4.0(7y ago)1670MITPHPPHP &gt;=7.1

Since Sep 18Pushed 7y ago1 watchersCompare

[ Source](https://github.com/andrey-helldar/helpers)[ Packagist](https://packagist.org/packages/andrey-helldar/helpers)[ Docs](http://ai-rus.com)[ RSS](/packages/andrey-helldar-helpers/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (4)Versions (39)Used By (0)

Helpers for Laravel 5.5+
------------------------

[](#helpers-for-laravel-55)

Functions that simplify the development process.

[![helpers](https://user-images.githubusercontent.com/10347617/40197726-f252894e-5a1c-11e8-8466-0f7fcd186e26.png)](https://user-images.githubusercontent.com/10347617/40197726-f252894e-5a1c-11e8-8466-0f7fcd186e26.png)

 [![StyleCI](https://camo.githubusercontent.com/bb58b0bad467167f9f2764dc282cc764d26afafde3ff7b19b5e1d1fc90d78690/68747470733a2f2f7374796c6563692e696f2f7265706f732f3130333936333437322f736869656c64)](https://styleci.io/repos/103963472) [![Total Downloads](https://camo.githubusercontent.com/a4e69a992602cf473c33f6acfd3232e8778d9a2e57a1b4de07fb9c2d610d83e4/68747470733a2f2f706f7365722e707567782e6f72672f616e647265792d68656c6c6461722f68656c706572732f646f776e6c6f6164733f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/andrey-helldar/helpers) [![Latest Stable Version](https://camo.githubusercontent.com/158382aff82d42772d132ee8b78c831f62815a7894054bc5477a62f06d8ddd46/68747470733a2f2f706f7365722e707567782e6f72672f616e647265792d68656c6c6461722f68656c706572732f76657273696f6e3f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/andrey-helldar/helpers) [![Latest Unstable Version](https://camo.githubusercontent.com/6111f201d50f55d5e9781cb242496f24d33631c7873348ad43462ffa8da75f31/68747470733a2f2f706f7365722e707567782e6f72672f616e647265792d68656c6c6461722f68656c706572732f762f756e737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/andrey-helldar/helpers) [![License](https://camo.githubusercontent.com/5fe13c31c355f2b46b4f39b80f324f102da6a9e10e1217e5be2fc7b5cc536ad7/68747470733a2f2f706f7365722e707567782e6f72672f616e647265792d68656c6c6461722f68656c706572732f6c6963656e73653f666f726d61743d666c61742d737175617265)](LICENSE)

Attention
---------

[](#attention)

This package is abandoned and no longer maintained. The author suggests using the [andrey-helldar/support](https://github.com/andrey-helldar/support) package instead.

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

[](#installation)

To get the latest version of Helpers, simply require the project using [Composer](https://getcomposer.org/):

```
$ composer require andrey-helldar/helpers
```

Instead, you may of course manually update your require block and run `composer update` if you so choose:

```
{
    "require": {
        "andrey-helldar/helpers": "^1.0"
    }
}
```

If you don't use auto-discovery, add the ServiceProvider to the providers array in `config/app.php`:

```
Helldar\Helpers\LaravelServiceProvider::class,
```

You can also publish the config file to change implementations (ie. interface to specific class):

```
php artisan vendor:publish --provider="Helldar\Helpers\ServiceProvider"

```

Now you can use helpers or access directly to interfaces.

Enjoy!

Documentation
-------------

[](#documentation)

### Menu

[](#menu)

- [Arrays](#arrays)
    - [array\_item\_value\_max\_length](#array_item_value_max_length)
    - [array\_add\_unique](#array_add_unique)
    - [array\_rename\_keys](#array_rename_keys)
    - [array\_size\_max\_value](#array_size_max_value)
    - [array\_sort\_by\_keys\_array](#array_sort_by_keys_array)
- [Digits](#digits)
    - [factorial](#factorial)
    - [short\_number](#short_number)
- [Dumper](#dumper)
    - [dd\_sql](#dd_sql)
- [Files](#files)
    - [url\_file\_exists](#url_file_exists)
- [Http](#http)
    - [mix\_url](#mix_url)
    - [base\_url](#base_url)
    - [build\_url](#build_url)
    - [subdomain\_name](#subdomain_name)
- [Jsonable](#jsonable)
- [Images](#images)
    - [image\_or\_default](#image_or_default)
- [Notifications](#notifications)
- [Strings](#strings)
    - [str\_choice](#str_choice)
    - [e](#e)
    - [de](#de)
    - [str\_replace\_spaces](#str_replace_spaces)
- [Systems](#systems)
    - [is\_windows](#is_windows)
    - [is\_linux](#is_linux)

### Arrays

[](#arrays)

#### array\_item\_value\_max\_length()

[](#array_item_value_max_length)

Returns the number of characters of the longest element in the array:

```
echo array_item_value_max_length(array $array = []) : int

echo (new \Helldar\Helpers\Support\Arr(array $array = []))
    ->arrayItemValueMaxLength() : int
```

#### array\_add\_unique()

[](#array_add_unique)

Push one a unique element onto the end of array:

```
array_add_unique(array &$array, $value)

(new \Helldar\Helpers\Support\Arr())
    ->addUnique(&$array, $value = 'value')

(new \Helldar\Helpers\Support\Arr())
    ->addUnique(&$array, $value = ['value1', 'value2', ...])
```

#### array\_rename\_keys()

[](#array_rename_keys)

Renaming array keys. As the first parameter, a callback function is passed, which determines the actions for processing the value. The output of the function must be a string with a name.

```
return array_rename_keys($callback, array $array = []) : array

return (new \Helldar\Helpers\Support\Arr(array $array = []))
    ->arrayRenameKeys($callback) : array
```

#### array\_size\_max\_value()

[](#array_size_max_value)

Get the size of the longest text element of the array:

```
return array_size_max_value(array $array = []) : int

return (new \Helldar\Helpers\Support\Arr((array $array = []))
    ->arraySizeOfMaxValue() : int
```

#### array\_sort\_by\_keys\_array()

[](#array_sort_by_keys_array)

Sort an associative array in the order specified by an array of keys.

```
array_sort_by_keys_array($array, $sorter) : void

(new \Helldar\Helpers\Support\Arr())
    ->sortByKeysArray($array, $sorter) : void
```

```
Example:

```

```
$arr = ['q' => 1, 'r' => 2, 's' => 5, 'w' => 123];

array_sort_by_keys_array($arr, ['q', 'w', 'e']);

print_r($arr);

/*
Array
(
    [q] => 1
    [w] => 123
    [r] => 2
    [s] => 5
)
```

\[ [to top](#) | [to menu](#menu) \]

### Digits

[](#digits)

#### factorial()

[](#factorial)

Calculating the factorial of a number:

```
echo factorial(int $n = 0) : int

echo (new \Helldar\Helpers\Support\Digits())
    ->factorial(int $n = 0) : int
```

#### short\_number()

[](#short_number)

Converts a number into a short version:

```
echo short_number($n = 0, $precision = 1) : int|string

echo (new \Helldar\Helpers\Support\Digits($n = 0))
    ->shortNumber($precision = 1) : int|string
```

```
Example:

```

```
short_number(576);
// returns: 576

short_number(1000);
// returns: 1K

short_number(1440);
// returns: 1.4K

short_number(3000000);
// returns: 3M

short_number(3000000000);
// returns: 3B

short_number(3000000000000);
// returns: 3T+
```

\[ [to top](#) | [to menu](#menu) \]

### Dumper

[](#dumper)

#### dd\_sql()

[](#dd_sql)

Dump the passed variables and end the script.

```
return dd_sql($query, bool $is_short = false, bool $is_return = false) : array|string|void

return (new \Helldar\Helpers\Support\Dumper($query))
    ->ddSql($is_short, $is_return) : array|string|void
```

\[ [to top](#) | [to menu](#menu) \]

### Files

[](#files)

#### url\_file\_exists()

[](#url_file_exists)

Checks whether a file or directory exists on URL:

```
return url_file_exists($path) : bool

return (new \Helldar\Helpers\Support\Files($path))
    ->urlFileExists() : bool
```

\[ [to top](#) | [to menu](#menu) \]

### Http

[](#http)

#### mix\_url()

[](#mix_url)

Convert the relative path of a versioned Mix files to absolute.

```
return mix_url($path) : string

return (new \Helldar\Helpers\Support\Http($path))
    ->mixUrl() : string
```

#### base\_url()

[](#base_url)

Get the domain name from the URL.

```
return base_url($url) : string

return (new \Helldar\Helpers\Support\Http($url))
    ->baseUrl() : string
```

#### build\_url()

[](#build_url)

Reverse function for parse\_url() ().

The code is taken from [gist.github.com/Ellrion](https://gist.github.com/Ellrion/f51ba0d40ae1d62eeae44fd1adf7b704)

```
$parts1 = [
    'scheme' => 'http',
    'host'   => 'mysite.dev',
];

$parts2 = [
    'scheme'   => 'https',
    'host'     => 'mysite.dev',
    'port'     => 1234,
    'user'     => 'foo',
    'pass'     => 'bar',
    'path'     => '/category/subcategory',
    'query'    => 'page=1',
    'fragment' => 'section=5',
];

return build_url($parts1) : string
return (new \Helldar\Helpers\Support\Http($parts2))
    ->buildUrl();

// returned 1: http://mysite.dev
// returned 2: https://foo:bar@mysite.dev:1234/category/subcategory?page=1#section=5
```

#### subdomain\_name()

[](#subdomain_name)

Retrieving the current subdomain name.

```
return subdomain_name();

return (new \Helldar\Helpers\Support\Http())
    ->getSubdomain();

// from domain `test.mysite.local` will return `test` (string).
// from domain `mysite.local` will return `null` (null).
```

\[ [to top](#) | [to menu](#menu) \]

### Jsonable

[](#jsonable)

Convert the object to its JSON representation.

The code is taken from [gist.github.com/Ellrion](https://gist.github.com/Ellrion/2c7648d3ebdef2cd8ed24ffa78cf1d3d)

```
use Helldar\Traits\Jsonable;

class MyClass
{
    use Jsonable;

    public function __construct($data)
    {
        $this->setData($data);
    }
}

$obj = new MyClass($data);
echo $obj->toJson();
```

\[ [to top](#) | [to menu](#menu) \]

### Images

[](#images)

#### image\_or\_default()

[](#image_or_default)

Check the existence of the file and return the default value if it is missing:

```
echo image_or_default(string $filename, $default = null) : string

echo (new \Helldar\Helpers\Support\Images($filename))
    ->imageOrDefault($default = null) : string
```

\[ [to top](#) | [to menu](#menu) \]

### Notifications

[](#notifications)

Notification helpers were placed in a separate package [andrey-helldar/notify-exceptions](https://github.com/andrey-helldar/notify-exceptions).

\[ [to top](#) | [to menu](#menu) \]

### Strings

[](#strings)

#### str\_choice()

[](#str_choice)

The str\_choice function translates the given language line with inflection:

```
echo str_choice(int $num, array $choice = [], string $additional = '') : string

echo (new \Helldar\Helpers\Support\Str($num))
    ->choice(array $choice = [], string $additional = '') : string
```

```
Example:

```

```
echo str_choice(1, ['пользователь', 'пользователя', 'пользователей']);
// returned "пользователь"

echo str_choice(3, ['пользователь', 'пользователя', 'пользователей']);
// returned "пользователя"

echo str_choice(20, ['пользователь', 'пользователя', 'пользователей']);
// returned "пользователей"

echo str_choice(20, ['пользователь', 'пользователя', 'пользователей'], 'здесь');
// returned "пользователей здесь"
```

#### e()

[](#e)

Escape HTML special characters in a string:

```
echo e($value) : string

echo (new \Helldar\Helpers\Support\Str($value))
    ->e() : string
```

#### de()

[](#de)

Convert special HTML entities back to characters:

```
echo de($value) : string

echo (new \Helldar\Helpers\Support\Str($value))
    ->de() : string
```

#### str\_replace\_spaces()

[](#str_replace_spaces)

Replacing multiple spaces with a single space.

```
echo str_replace_spaces($value) : string

echo (new \Helldar\Helpers\Support\Str($value))
    ->replaceSpaces() : string
```

\[ [to top](#) | [to menu](#menu) \]

### Systems

[](#systems)

#### is\_windows()

[](#is_windows)

Determine whether the current environment is Windows based:

```
return is_windows() : bool

return (new \Helldar\Helpers\Support\System())
    ->isWindows() : bool
```

#### is\_linux()

[](#is_linux)

Determine whether the current environment is Linux based:

```
return is_linux() : bool

return (new \Helldar\Helpers\Support\System())
    ->isLinux() : bool
```

\[ [to top](#) | [to menu](#menu) \]

Copyright and License
---------------------

[](#copyright-and-license)

Helpers was written by Andrey Helldar for the Laravel framework 5.5 or later, and is released under the MIT License. See the [LICENSE](LICENSE) file for details.

Translation
-----------

[](#translation)

Translations of text and comment by Google Translate. Help with translation +1 in karma :)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity70

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

Recently: every ~38 days

Total

38

Last Release

2774d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.0

1.0.1PHP &gt;=7.1

### Community

Maintainers

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

---

Tags

laravelhelpershelldar

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[nativephp/mobile

NativePHP for Mobile

82724.0k43](/packages/nativephp-mobile)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[bensampo/laravel-embed

Painless responsive embeds for videos, slideshows and more.

142146.8k](/packages/bensampo-laravel-embed)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[dragon-code/pretty-routes

Pretty Routes for Laravel

10058.7k4](/packages/dragon-code-pretty-routes)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)

PHPackages © 2026

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