yiier / yii2-hashids
Hashids for Yii2
v3.0.0
2022-04-24 03:43 UTC
Requires
- php: ^7.4 || ^8.0
- hashids/hashids: ^4.1
- yiisoft/yii2: ^2.0.42
Requires (Dev)
- phpunit/phpunit: ^7.0 || ^8.0
- yiisoft/yii2-coding-standards: ~2.0
README
Installation
Install this package via Composer:
$ composer require yiier/yii2-hashids
Usage
configurate is as a component
In your main.php
or web.php
(dependences your yii2 project constructor):
[ 'hahsids' => [ 'class' => 'yiier\hashids\Hashids', //'salt' => 'your salt', //'minHashLength' => 5, //'alphabet' => 'abcdefghigk' ] ]
Also using this like this:
$hashids = Yii::createObject([ 'class' => 'yiier\hashids\Hashids' ]); $id = $hashids->encode(1, 2, 3); $numbers = $hashids->decode($id); var_dump($id, $numbers);
Test
$ phpunit