shetabit / helper
There is no license information available for the latest version (v1.3) of this package.
This Package helps developers to work with custom helpers
v1.3
2019-03-07 09:26 UTC
Requires
- php: >=7.0
- hekmatinasser/verta: ^1.9
This package is auto-updated.
Last update: 2024-11-19 22:04:45 UTC
README
This Package helps developers to work with custom helpers.
Installation
Require this package with composer:
composer require shetabit/helper
Laravel >=5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php:
Shetabit\Helper\HelperServiceProvider::class,
If you want to use the facade, add this to your facades in app.php:
'Helper' => Shetabit\Helper\Facades::class,
List of helpers
- Random Password
- Persian Slug
- Persian To English Numbers
- Remove Comma
- Jalali To Gregorian
- Mb Json Encode
Random Password
Generate random password. $availableSets parameter: 'l' => lowercase alphabets, 'u' => uppercase, 'd' => digits, 's' => symbols
...randomPassword(int $length = 9, string $availableSets = 'luds'); Helper::randomPassword(); //Output: '9nZnE%3wB' //Or random_password(); //Output: '9nZnE%3wB'
Persian Slug
Generate persian slug.
...persianSlug(string $string, string $separator = '-') Helper::persianSlug('ایران سرای من'); //Output: 'ایران-سرای-من' //Or persian_slug('ایران سرای من'); //Output: 'ایران-سرای-من'
Persian To English Numbers
Convert all Persian(Farsi) numbers to English.
...faToEnNums(string $number) Helper::faToEnNums('۵۶89٤٦'); //Output: '568946' //Or fa_to_en_nums('۵۶89٤٦'); //Output: '568946'
Remove Comma
Remove comma's from value.
...removeComma(string $value) Helper::removeComma('5000,000'); //Output: '5000000' //Or remove_comma('5000,000') //Output: '5000000'
Jalali To Gregorian
Convert jalali date to gregorian date.
...toGregorian(string $jDate) Helper::toGregorian('1397/12/11'); //Output: '2018/3/2' //Or to_gregorian('1397/12/11') //Output: '2018/3/2'
Mb Json Encode
json_encode() for multibyte characters.
...mbJsonEncode(array $input) Helper::mbJsonEncode(['name' => 'علی', 'family' => 'حمزه ای']); //Output: '{"name":"علی","family":"حمزه ای"}' //Or mb_json_encode(['name' => 'علی', 'family' => 'حمزه ای']) //Output: '{"name":"علی","family":"حمزه ای"}'