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

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

vinkla/hashids
==============

A Hashids bridge for Laravel

14.0.0(1mo ago)2.1k13.3M—8.3%17920MITPHPPHP ^8.3CI passing

Since Feb 5Pushed 1mo ago32 watchersCompare

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

READMEChangelog (10)Dependencies (16)Versions (31)Used By (20)

[![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/044af5be487aa22ec56615ae7d6e83f831ef10672b927836f45ab30d5db44bfc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f76696e6b6c612f6c61726176656c2d686173686964732f706870756e69742e796d6c3f6272616e63683d6d6173746572266c6162656c3d7465737473)](https://github.com/vinkla/laravel-hashids/actions)[![Monthly Downloads](https://camo.githubusercontent.com/86a3bae90b00760fc0be101ada5b09fdaabc25ac2c31b3418dfb3323801cefc0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f76696e6b6c612f68617368696473)](https://packagist.org/packages/vinkla/hashids/stats)[![Latest Version](https://camo.githubusercontent.com/2535087b05f736c1f07ce1557fe8698c9e0f36728a9a2224d322bd69e30fc89c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76696e6b6c612f68617368696473)](https://packagist.org/packages/vinkla/hashids)

[ ![Sqids](https://private-user-images.githubusercontent.com/499192/408860913-75864e3a-483c-4b6f-9b0b-66f5e3d6e736.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUyNTI3NDgsIm5iZiI6MTc3NTI1MjQ0OCwicGF0aCI6Ii80OTkxOTIvNDA4ODYwOTEzLTc1ODY0ZTNhLTQ4M2MtNGI2Zi05YjBiLTY2ZjVlM2Q2ZTczNi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwNDAzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDQwM1QyMTQwNDhaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05MmY1NWQxNjM4ZGYwYjM0ODBhN2U0NzEzNzZmNmUzMjZlMWIyNmVjMjgwOGQ2ZjY0ZGI2ZTQyNzNmMjg1ZGU5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.HftqANl5g-dCQoF8OzMF8IrY9JKFpaWW7n-NpCCN8BQ)](https://sqids.org/)Note

The creator of Hashids has released a new, upgraded version rebranded as **Sqids**. However, Hashids will continue to be maintained and available for future use. For more information, please visit the [Sqids repository](https://github.com/sqids/sqids-php) and learn how it compares to Hashids on the [Sqids website](https://sqids.org/faq#hashids). **The API is so simple that you don't need a Laravel package at all.**

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

[](#installation)

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

```
composer require vinkla/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

78

—

ExcellentBetter than 100% of packages

Maintenance89

Actively maintained with recent releases

Popularity73

Solid adoption and visibility

Community46

Growing community involvement

Maturity89

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 91.3% 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 ~140 days

Recently: every ~360 days

Total

30

Last Release

58d ago

Major Versions

9.1.0 → 10.0.02022-01-24

10.0.1 → 11.0.02023-02-26

11.0.0 → 12.0.02024-02-05

12.0.0 → 13.0.02025-03-02

13.0.0 → 14.0.02026-03-22

PHP version history (15 changes)1.0.0PHP &gt;=5.4.7

1.1.0PHP &gt;=5.5.9

2.2.1PHP ^5.5.9 || ^7.0

2.4.0PHP ^5.6.4 || ^7.0

3.1.0PHP ^7.0

4.0.0PHP ^7.1.3

6.0.0PHP ^7.2

8.0.0PHP ^7.4

8.1.0PHP ^7.2.5

9.0.0PHP ^7.3

9.1.0PHP ^7.3 || ^8.0

10.0.0PHP ^8.0

11.0.0PHP ^8.1

12.0.0PHP ^8.2

14.0.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/63e77154439395019fb74adc3d1402bbba09ab726c74e2448968a1174c6a4415?d=identicon)[vinkla](/maintainers/vinkla)

---

Top Contributors

[![vinkla](https://avatars.githubusercontent.com/u/499192?v=4)](https://github.com/vinkla "vinkla (261 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)")[![Indemnity83](https://avatars.githubusercontent.com/u/35218?v=4)](https://github.com/Indemnity83 "Indemnity83 (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (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)")[![PixellUp](https://avatars.githubusercontent.com/u/4704339?v=4)](https://github.com/PixellUp "PixellUp (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)")[![asbiin](https://avatars.githubusercontent.com/u/25419741?v=4)](https://github.com/asbiin "asbiin (1 commits)")[![ysbrandB](https://avatars.githubusercontent.com/u/72889753?v=4)](https://github.com/ysbrandB "ysbrandB (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)")[![kainxspirits](https://avatars.githubusercontent.com/u/5594710?v=4)](https://github.com/kainxspirits "kainxspirits (1 commits)")

---

Tags

composerhashidslaravelphplaravelhashids

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[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)[dragon-code/pretty-routes

Pretty Routes for Laravel

10058.7k4](/packages/dragon-code-pretty-routes)

PHPackages © 2026

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