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

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

jimchen/yii2-hashids
====================

Hashids for Yii framework

0.1.0(7y ago)51.3k1[1 issues](https://github.com/JimChenWYU/yii2-hashids/issues)MITPHPPHP &gt;=5.5

Since Aug 29Pushed 7y ago1 watchersCompare

[ Source](https://github.com/JimChenWYU/yii2-hashids)[ Packagist](https://packagist.org/packages/jimchen/yii2-hashids)[ RSS](/packages/jimchen-yii2-hashids/feed)WikiDiscussions master Synced yesterday

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

yii2-hashids
============

[](#yii2-hashids)

Hashids for Yii framework

Installing
----------

[](#installing)

```
$ composer require jimchen/yii2-hashids -vvv
```

Usage
-----

[](#usage)

### Configure application components as follows

[](#configure-application-components-as-follows)

```
return [
    //...
    'components' => [
        //...
        'hashids' => [
            'class' => 'jimchen\hashids\HashidsComponent',
            'salt' => 'default channel salt',
            'length' => 'default channel length of the encode string',
            // 'default' => 'main' // default channel
            // 'connections' => null // other channel
        ],
    ],
];
```

the `connections` should defined like:

```
[
    ...
    'connections' => [
        'channel name' => [
            'salt' => 'the salt',
            'length' => 'the length of the encode string',
        ],
        ...
    ]
]
```

### Use in your code as follows(it use the default channel.)

[](#use-in-your-code-as-followsit-use-the-default-channel)

```
use Yii;

$encode = Yii::$app->hashids->encode(12345);

var_dump(Yii::$app->hashids->decode($encode)); // [12345]
```

### Use other channel

[](#use-other-channel)

```
use Yii;

$otherChannelHashids = \Yii::createObject('hashids.manager')->connection('channel name');

$encode = $otherChannelHashids->encode(12345);

var_dump($otherChannelHashids->decode($encode)); // [12345]
```

License
-------

[](#license)

MIT

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

2814d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/20cebafc45fd6fc5f67bf655119a3b27e9b208e248f2d7f5c98fd6c0a101485b?d=identicon)[jimchen](/maintainers/jimchen)

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[vinkla/hashids

A Hashids bridge for Laravel

2.1k13.3M73](/packages/vinkla-hashids)[ashallendesign/short-url

A Laravel package for creating shortened URLs for your web apps.

1.4k1.9M4](/packages/ashallendesign-short-url)[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)[deligoez/laravel-model-hashid

Generate, Save, and Route Stripe/Youtube-like Hash IDs for Laravel Eloquent Models

16498.0k](/packages/deligoez-laravel-model-hashid)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

52664.9k12](/packages/solspace-craft-freeform)[akiraz2/yii2-ticket-support

Yii2 Support Ticket Module, easy, flexible, fast

611.7k](/packages/akiraz2-yii2-ticket-support)

PHPackages © 2026

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