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

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

toanld/hashids
==============

A Hashids bridge for Laravel

v2.0.2(2y ago)064MITPHPPHP ^8.1

Since Oct 2Pushed 2y agoCompare

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

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

[![hashids](https://cloud.githubusercontent.com/assets/499192/11159205/faa429ae-8a5d-11e5-8c5d-c60a89290c5e.png)](https://cloud.githubusercontent.com/assets/499192/11159205/faa429ae-8a5d-11e5-8c5d-c60a89290c5e.png)

Laravel Hashids
===============

[](#laravel-hashids)

> A [Hashids](http://hashids.org) bridge for Laravel.

```
// Encode integers.
Hashids::encode(4815162342);

// Decode strings.
Hashids::decode('1LLb3b4ck');

// Dependency injection example.
$hashidsManager->encode(911);
```

[![Build Status](https://camo.githubusercontent.com/d1facbb9b07ce873a12f06847c38a9fe07512c0d9ca0ecc8e3c3e0d7f7e2cc61/68747470733a2f2f62616467656e2e6e65742f6769746875622f636865636b732f76696e6b6c612f6c61726176656c2d686173686964733f6c6162656c3d6275696c642669636f6e3d676974687562)](https://github.com/vinkla/laravel-hashids/actions)[![Monthly Downloads](https://camo.githubusercontent.com/d4bb926cf2de4996a03c5c9add32beae03f38c77f4193230bc3aa4f873a695ad/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f646d2f76696e6b6c612f68617368696473)](https://packagist.org/packages/vinkla/hashids/stats)[![Latest Version](https://camo.githubusercontent.com/4cdf7e3416e93114cc5450e4e7aeffd54e1f71ad0f937e94871d1e2c20f60d97/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f762f76696e6b6c612f68617368696473)](https://packagist.org/packages/vinkla/hashids)

Installation
------------

[](#installation)

Require this package, with [Composer](https://getcomposer.org/), in the root directory of your project.

```
composer require toanld/hashids
```

Configuration
-------------

[](#configuration)

Laravel Hashids requires connection configuration. To get started, you'll need to publish all vendor assets:

```
$ php artisan vendor:publish
```

This will create a `config/hashids.php` file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.

#### Default Connection Name

[](#default-connection-name)

This option `default` is where you may specify which of the connections below you wish to use as your default connection for all work. Of course, you may use many connections at once using the manager class. The default value for this setting is `main`.

#### Hashids Connections

[](#hashids-connections)

This option `connections` is where each of the connections are setup for your application. Example configuration has been included, but you may add as many connections as you would like.

Usage
-----

[](#usage)

Here you can see an example of you may use this package. Out of the box, the default adapter is `main`. After you enter your authentication details in the config file, it will just work:

```
// You can alias this in config/app.php.
use Vinkla\Hashids\Facades\Hashids;

// We're done here - how easy was that, it just works!
Hashids::encode(4815162342);

// This example is simple and there are far more methods available.
Hashids::decode('doyouthinkthatsairyourebreathingnow');
```

The manager will behave like it is a `Hashids\Hashids` class. If you want to call specific connections, you can do that with the connection method:

```
use Vinkla\Hashids\Facades\Hashids;

// Writing this...
Hashids::connection('main')->encode($id);

// ...is identical to writing this
Hashids::encode($id);

// and is also identical to writing this.
Hashids::connection()->encode($id);

// This is because the main connection is configured to be the default.
Hashids::getDefaultConnection(); // This will return main.

// We can change the default connection.
Hashids::setDefaultConnection('alternative'); // The default is now alternative.
```

If you prefer to use dependency injection over facades, then you can inject the manager:

```
use Vinkla\Hashids\HashidsManager;

class Foo
{
    protected $hashids;

    public function __construct(HashidsManager $hashids)
    {
        $this->hashids = $hashids;
    }

    public function bar($id)
    {
        $this->hashids->encode($id);
    }
}

App::make('Foo')->bar();
```

For more information on how to use the `Hashids\Hashids` class, check out the docs at [`hashids/hashids`](https://github.com/vinkla/hashids.php).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.8% 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 ~381 days

Total

2

Last Release

943d ago

Major Versions

v1.0.1 → v2.0.22023-10-18

PHP version history (2 changes)v1.0.1PHP ^8.0

v2.0.2PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/b884bdad7cead7cd70b807b4c4f3453d6eee6f4e7e8326b42a799553fb63eb9c?d=identicon)[toanld1905](/maintainers/toanld1905)

---

Top Contributors

[![vinkla](https://avatars.githubusercontent.com/u/499192?v=4)](https://github.com/vinkla "vinkla (236 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (4 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (3 commits)")[![toanld](https://avatars.githubusercontent.com/u/33773069?v=4)](https://github.com/toanld "toanld (3 commits)")[![Indemnity83](https://avatars.githubusercontent.com/u/35218?v=4)](https://github.com/Indemnity83 "Indemnity83 (2 commits)")[![lucasmichot](https://avatars.githubusercontent.com/u/513603?v=4)](https://github.com/lucasmichot "lucasmichot (2 commits)")[![Omranic](https://avatars.githubusercontent.com/u/406705?v=4)](https://github.com/Omranic "Omranic (1 commits)")[![palvaneh](https://avatars.githubusercontent.com/u/12458954?v=4)](https://github.com/palvaneh "palvaneh (1 commits)")[![ptondereau](https://avatars.githubusercontent.com/u/4287777?v=4)](https://github.com/ptondereau "ptondereau (1 commits)")[![unicodeveloper](https://avatars.githubusercontent.com/u/2946769?v=4)](https://github.com/unicodeveloper "unicodeveloper (1 commits)")[![kainxspirits](https://avatars.githubusercontent.com/u/5594710?v=4)](https://github.com/kainxspirits "kainxspirits (1 commits)")[![chivincent](https://avatars.githubusercontent.com/u/7449005?v=4)](https://github.com/chivincent "chivincent (1 commits)")[![davidnknight](https://avatars.githubusercontent.com/u/1526840?v=4)](https://github.com/davidnknight "davidnknight (1 commits)")[![foremtehan](https://avatars.githubusercontent.com/u/53290883?v=4)](https://github.com/foremtehan "foremtehan (1 commits)")[![Gummibeer](https://avatars.githubusercontent.com/u/6187884?v=4)](https://github.com/Gummibeer "Gummibeer (1 commits)")[![asbiin](https://avatars.githubusercontent.com/u/25419741?v=4)](https://github.com/asbiin "asbiin (1 commits)")

---

Tags

laravelhashids

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[vinkla/hashids

A Hashids bridge for Laravel

2.1k13.3M73](/packages/vinkla-hashids)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[cybercog/laravel-optimus

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

192564.1k](/packages/cybercog-laravel-optimus)[deligoez/laravel-model-hashid

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

16498.0k](/packages/deligoez-laravel-model-hashid)[tonysm/importmap-laravel

Use ESM with importmap to manage modern JavaScript in Laravel without transpiling or bundling.

148399.8k1](/packages/tonysm-importmap-laravel)[bensampo/laravel-embed

Painless responsive embeds for videos, slideshows and more.

142146.8k](/packages/bensampo-laravel-embed)

PHPackages © 2026

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