light/hashids

Hashids for Yii2

Installs: 19 382

Dependents: 0

Suggesters: 0

Security: 0

Stars: 11

Watchers: 2

Forks: 1

Open Issues: 1

pkg:composer/light/hashids

2.0.0 2018-02-28 15:22 UTC

This package is auto-updated.

Last update: 2025-10-08 21:20:51 UTC


README

Yii2 Hashids


Build Status version Download Issues

NOTE: The master branch for 2.0 version, that require mini php version is 5.6. You can require light/hashids:^1.0to use old version.

Installation

Install this package via Composer:

$ 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

MIT

Bitdeli Badge