PHPackages                             light/hashids - 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. light/hashids

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

light/hashids
=============

Hashids for Yii2

2.0.0(8y ago)1120.2k1[1 issues](https://github.com/lichunqiang/hashids/issues)MITPHPPHP ^5.6.4 || ^7.0

Since Aug 6Pushed 8y ago2 watchersCompare

[ Source](https://github.com/lichunqiang/hashids)[ Packagist](https://packagist.org/packages/light/hashids)[ RSS](/packages/light-hashids/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (6)Used By (0)

 [ ![](https://avatars0.githubusercontent.com/u/993323) ](https://github.com/yiisoft)

Yii2 Hashids
============

[](#yii2-hashids)

[![Build Status](https://camo.githubusercontent.com/7bfd2b7c4e2cff58766dbc7d9a5cf86f0daad8a7fb6c5266db0e71e90208c796/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6c696368756e7169616e672f686173686964732e7376673f7374796c653d666c61742d737175617265)](http://travis-ci.org/lichunqiang/hashids)[![version](https://camo.githubusercontent.com/773fee51cf7e0731a515ce8d4b243623df0967d5570d6cb7e1d0c06153845d07/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c696768742f686173686964732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/light/hashids)[![Download](https://camo.githubusercontent.com/29d0e2bc500897963c7fa78d9b343e094c2cf5a3231f24db863b66373da973d9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c696768742f686173686964732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/light/hashids)[![Issues](https://camo.githubusercontent.com/bc7273a6a0e0305b25c11f61c0c6d8a430b9cd84e0cf9c23ee0de298ffc7a561/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6c696368756e7169616e672f686173686964732e7376673f7374796c653d666c61742d737175617265)](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
------------

[](#installation)

Install this package via [Composer](https://getcomposer.org/):

```
$ composer require light/hashids=^2.0

```

Usage
-----

[](#usage)

### configurate is as a component

[](#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
----

[](#test)

```
$ phpunit

```

Lisence
-------

[](#lisence)

[![MIT](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)

[![Bitdeli Badge](https://camo.githubusercontent.com/6bbe3ec418d4a1a0f1404eefb3cda5276d71c1942471c5c4f9125e63d9eb1a5b/68747470733a2f2f64327765637a68766c38323376302e636c6f756466726f6e742e6e65742f6c696368756e7169616e672f686173686964732f7472656e642e706e67)](https://bitdeli.com/free "Bitdeli Badge")

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 90% 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 ~234 days

Total

5

Last Release

3001d ago

Major Versions

1.0.x-dev → 2.0.02018-02-28

PHP version history (2 changes)1.0.0PHP &gt;=5.4.0

2.0.0PHP ^5.6.4 || ^7.0

### Community

Maintainers

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

---

Top Contributors

[![lichunqiang](https://avatars.githubusercontent.com/u/2433916?v=4)](https://github.com/lichunqiang "lichunqiang (18 commits)")[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")[![f-dg](https://avatars.githubusercontent.com/u/8408092?v=4)](https://github.com/f-dg "f-dg (1 commits)")

---

Tags

hashidsyii2yii2-extensionyii2-hashidsencryptdecrypthashyoutubeidshashidshashidyii2biyly

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/light-hashids/health.svg)

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

###  Alternatives

[hashids/hashids

Generate short, unique, non-sequential ids (like YouTube and Bitly) from numbers

5.4k48.6M278](/packages/hashids-hashids)[elfsundae/laravel-hashid

A simple, elegant way to obfuscate your data by generating reversible, non-sequential, URL-safe identifiers.

415246.3k2](/packages/elfsundae-laravel-hashid)[cybercog/laravel-optimus

An Optimus bridge for Laravel. Id obfuscation based on Knuth's multiplicative hashing method.

192564.1k](/packages/cybercog-laravel-optimus)[lingxi/hashids

A Hashids bridge for Laravel

183.3k](/packages/lingxi-hashids)[delight-im/ids

Short, obfuscated and efficient IDs for PHP

289.5k1](/packages/delight-im-ids)

PHPackages © 2026

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