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

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

achieffment/helpers
===================

My useful helpers for php development

1.0.18(1y ago)013PHP

Since Mar 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/achieffment/helpers)[ Packagist](https://packagist.org/packages/achieffment/helpers)[ RSS](/packages/achieffment-helpers/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (15)Used By (0)

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

[](#installation)

```
composer require achieffment/helpers

```

Helpers
-------

[](#helpers)

```
use achieffment\helpers\Helper;

Helper::print_r($array); // 'printed array'
Helper::var_dump($mixed); // 'dumped data'

echo Helper::makePhoneLink(''); // ''
echo Helper::makePhoneLink('', false); // false
echo Helper::makePhoneLink('7 (911) 911-91-91'); // +79119119191
echo Helper::makePhoneLink('7 (911) 911-91-91', true, true); // tel:+79119119191

echo Helper::makeMailLink(''); // ''
echo Helper::makeMailLink('', false); // false
echo Helper::makeMailLink('mail@mail.ru'); // mailto:mail@mail.ru

Helper::sendFileLog('data'); // Save to $_SERVER['DOCUMENT_ROOT'] . '/log.log';
Helper::sendFileLog('data', $_SERVER['DOCUMENT_ROOT'] . '/log.log'); // Save to $_SERVER['DOCUMENT_ROOT'] . '/log.log';
Helper::sendFileLog('data', '', true); // Shows time in log
Helper::sendFileLog('data', '', true, true); // Appends file
```

Validation
----------

[](#validation)

```
use achieffment\helpers\ValidatorHelper;

// make strip_tags, htmlspecialchars, trim and return false if value is empty else return sanitized string

$string = '';
$string = ValidatorHelper::validate($string);
echo $string; // false

$string = 'qwe';
$string = ValidatorHelper::validate($string);
echo $string; // qwe

$string = 'qwerty';
$string = ValidatorHelper::validate($string, 3); // check length
echo $string; // false

$string = 'qwerty';
$string = ValidatorHelper::validate($string, 0, true); // is number
echo $string; // false

// make strip_tags, htmlspecialchars, trim if value is not empty and return sanitized string

$string = '';
$string = ValidatorHelper::validateEmpty($string, 0, true); // is number
echo $string; // ''

$string = 'qwe';
$string = ValidatorHelper::validateEmpty($string, 0, true); // is number
echo $string; // 'qwe'

$string = 'qwerty';
$string = ValidatorHelper::validateEmpty($string, 3); // check length
echo $string; // ''

$string = 'qwerty';
$string = ValidatorHelper::validateEmpty($string, 0, true); // is number
echo $string; // ''

ValidatorHelper::validatePhone('+7 (111) 111-11-11', 11); // validates phone and check length

ValidatorHelper::validateIp('255.255.255.255'); // (true) is ip
ValidatorHelper::validateIp('255.255.255.255', false); // (true) is ip and can not be with port
ValidatorHelper::validateIp('255.255.255.255:80', true, false); // (true) is ip and has port
ValidatorHelper::validateIp('255.255.255.255', true, true); // (true) is ip and can be with port or not
```

Encoding
--------

[](#encoding)

### Text encoding:

[](#text-encoding)

```
use achieffment\helpers\SecurityHelper;

$encoded = SecurityHelper::encode('Simple string', 'aes-256-ctr', 'passphrase');

echo $encoded; // 48Fme9BnBDR9DrBGRw==

$decoded = SecurityHelper::decode($encoded, 'aes-256-ctr', 'passphrase');

echo $decoded; // Simple string
```

### Image encoding:

[](#image-encoding)

```
use achieffment\helpers\SecurityHelper;

$img = SecurityHelper::getImageContent($_SERVER['DOCUMENT_ROOT'] . '/image.jpg', false, true);

if ($img) {
    // Get encoded data of image
    $encoded_image = SecurityHelper::encode(
        $img,
        'aes-256-ctr',
        'passphrase'
    );

    // Save encoded data to file
    if ($encoded_image) {
        file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/image2.jpg', $encoded_image);
    }
}

// Get image element
$decoded_image = SecurityHelper::getImageElement(
    $_SERVER['DOCUMENT_ROOT'] . '/image2.jpg',
    'title',
    'alt',
    'lazy',
    true,
    'aes-256-ctr',
    'passphrase'
);

if ($decoded_image) {
    echo $decoded_image; //
}
```

Cities
------

[](#cities)

### By ip

[](#by-ip)

Helper uses DaData service to locate city by ip, for more information on  and ), it works only for Russian Federation.

```
use achieffment\helpers\CityHelper;

$cl = new CityHelper('Ухта', 'token', 'secret');

echo $cl->getCityByIp(false); // will not check robots like Yandex, Googlebot and etc.
echo $cl->getCityByIp(false, true); // will return city in morph case, for example: Ухте
echo $cl->getCityByIp(false, true, 'предложный'); // will return city in given case, for more information read code above
```

### Morph

[](#morph)

For more information about cases .

```
use achieffment\helpers\CityHelper;

echo CityHelper::getCityMorph('Ухта', 'предложный'); // (Ухте) will return city in given case
```

Recaptcha
---------

[](#recaptcha)

```
use achieffment\helpers\RecaptchaHelper;

echo RecaptchaHelper::reCAPTCHAV3JS('public', '#rcv_token'); // makes js for rcv3 and updates field with name rcv_token
echo RecaptchaHelper::reCAPTCHAV3JSOnlyAPI('public'); // makes js for rcv3
echo RecaptchaHelper::reCAPTCHAV3JSOnlyScript('public', '#rcv_token'); // makes scripts for updating field with name rcv_token
echo RecaptchaHelper::getRecaptchaLinks(); // get links for reCAPTCHA policy

RecaptchaHelper::reCAPTCHAV3Validate('secret', 'token', 'ip'); // sends request with secret and given token and returns true or false
```

Morph
-----

[](#morph-1)

For more information about cases .

```
use achieffment\helpers\MorphHelper;

echo getName('Иванов Петр', 'родительный') // Иванова Петра
echo getCity('Москва', 'родительный') // Москвы
echo getPluralize(10, 'новый дом') // 10 новых домов
echo getCardinalNumber(567, 'именительный') // пятьсот шестьдесят семь
echo getOrdinalNumber(961, 'именительный') // девятьсот шестьдесят первый
echo getTime(time() + 3600) // через 1 час
```

Telegram
--------

[](#telegram)

```
use achieffment\helpers\TelegramHelper;

$cl = new TelegramHelper('token', 'chat_id');

$result = $cl->sendMessage($text);
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~11 days

Recently: every ~17 days

Total

14

Last Release

629d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5c4db8b9ba0c4920e38839e7aba08b8ce2cb951549219fdf276744339b9be185?d=identicon)[achieffment](/maintainers/achieffment)

---

Top Contributors

[![achieffment](https://avatars.githubusercontent.com/u/57042116?v=4)](https://github.com/achieffment "achieffment (28 commits)")

### Embed Badge

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

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

###  Alternatives

[wapmorgan/yii2-inflection

Inflection extension for Yii2. Support for English / Russian languages to inflect words / names / numbers / money / date&amp;time.

32112.3k](/packages/wapmorgan-yii2-inflection)[rs/laravel-version-control

Foundations for making your app version controlled. Provides migration, blueprint and base models. Will make your app GxP compliant if you exclusively use the VC models and table structure as set out in this package.

1227.5k](/packages/rs-laravel-version-control)[mad-web/laravel-seoable

Easy to map your eloquent fields to seo properties

407.6k](/packages/mad-web-laravel-seoable)

PHPackages © 2026

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