https://github.com/lichunqiang/hashids
Hashids for Yii2
https://github.com/lichunqiang/hashids
hashids yii2 yii2-extension yii2-hashids
Last synced: 6 months ago
JSON representation
Hashids for Yii2
- Host: GitHub
- URL: https://github.com/lichunqiang/hashids
- Owner: lichunqiang
- Created: 2015-08-05T15:34:23.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-02-28T15:40:03.000Z (over 7 years ago)
- Last Synced: 2024-10-12T12:31:16.022Z (12 months ago)
- Topics: hashids, yii2, yii2-extension, yii2-hashids
- Language: PHP
- Homepage: http://hashids.org/php/
- Size: 29.3 KB
- Stars: 11
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Yii2 Hashids
[](http://travis-ci.org/lichunqiang/hashids)
[](https://packagist.org/packages/light/hashids)
[](https://packagist.org/packages/light/hashids)
[](https://github.com/lichunqiang/hashids/issues)__NOTE__: The master branch for 2.0 version, that require mini php version is 5.6. You can require `light/hashids:^1.0`to use old version.
## Installation
Install this package via [Composer](https://getcomposer.org/):
```
$ composer require light/hashids=^2.0
```## Usage
### configurate is as a component
In your `main.php` or `web.php` (dependences your yii2 project constructor):
```
[
'hahsids' => [
'class' => 'light\hashids\Hashids',
//'salt' => 'your salt',
//'minHashLength' => 5,
//'alphabet' => 'abcdefghigk'
]
]
```Also using this like this:
```
$hashids = Yii::createObject([
'class' => 'light\hashids\Hashids'
]);$id = $hashids->encode(1, 2, 3);
$numbers = $hashids->decode($id);
var_dump($id, $numbers);
```## Test
```
$ phpunit
```## Lisence

[](https://bitdeli.com/free "Bitdeli Badge")