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

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

torann/hashids
==============

Laravel package for Hashids

3.0.6(3mo ago)54335.1k↓26.5%11BSD-2-ClausePHPPHP ^7.4|^8.0

Since Sep 11Pushed 3mo ago5 watchersCompare

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

READMEChangelog (9)Dependencies (6)Versions (14)Used By (0)

Hashids for Laravel
===================

[](#hashids-for-laravel)

[![Latest Stable Version](https://camo.githubusercontent.com/2568409292c4c0d4193084a9409a316a5beaced10ca7945f3fe546cff9e727c5/68747470733a2f2f706f7365722e707567782e6f72672f746f72616e6e2f686173686964732f762f737461626c652e706e67)](https://packagist.org/packages/torann/hashids) [![Total Downloads](https://camo.githubusercontent.com/bf97b4594c161e305f358090fad4ef411dbb9d6101ab8442e5bb4318e221d101/68747470733a2f2f706f7365722e707567782e6f72672f746f72616e6e2f686173686964732f646f776e6c6f6164732e706e67)](https://packagist.org/packages/torann/hashids)

This package uses the classes created by [hashids.org](http://www.hashids.org/ "http://www.hashids.org/")

Generate hashes from numbers, like YouTube or Bitly. Use hashids when you do not want to expose your database ids to the user.

---

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

[](#installation)

- [Hashids on Packagist](https://packagist.org/packages/torann/hashids)
- [Hashids on GitHub](https://github.com/torann/laravel-hashids)

### Composer

[](#composer)

From the command line run:

```
$ composer require torann/hashids
```

**Without Package Auto-Discovery**

Once Hashids is installed you need to register the service provider and facade with the application. Open up `config/app.php` and find the `providers` and `aliases` keys.

```
'providers' => [
    Torann\Hashids\HashidsServiceProvider::class,
]

'aliases' => [
    'Hashids' => Torann\Hashids\Facade\Hashids::class,
]
```

### Publish the configurations

[](#publish-the-configurations)

Run this on the command line from the root of your project:

```
$ php artisan vendor:publish --provider="Torann\Hashids\HashidsServiceProvider"

```

A configuration file will be publish to `config/hashids.php`.

Usage
-----

[](#usage)

Once you've followed all the steps and completed the installation you can use Hashids.

### Encoding

[](#encoding)

You can simply encode a single id:

```
Hashids::encode(1); // Returns Ri7Bi
```

or multiple..

```
Hashids::encode(1, 21, 12, 12, 666); // Returns MMtaUpSGhdA
```

### Decoding

[](#decoding)

```
Hashids::decode(Ri7Bi);

// Returns
array (size=1)
0 => int 1
```

or multiple..

```
Hashids::decode(MMtaUpSGhdA);

// Returns
array (size=5)
0 => int 1
1 => int 21
2 => int 12
3 => int 12
4 => int 666
```

All credit for Hashids goes to Ivan Akimov (@ivanakimov), thanks to for making it!

###  Health Score

59

—

FairBetter than 99% of packages

Maintenance78

Regular maintenance activity

Popularity48

Moderate usage in the ecosystem

Community15

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 96.7% 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 ~345 days

Recently: every ~448 days

Total

13

Last Release

118d ago

Major Versions

0.3.1 → 1.0.02014-09-11

1.0.0 → 2.0.02015-02-15

2.0.3 → 3.0.02020-09-30

PHP version history (6 changes)0.3.1PHP &gt;=5.3.0

2.0.1PHP &gt;=5.4.0

2.0.2PHP &gt;=5.6

3.0.0PHP ^7.2

3.0.2PHP &gt;=7.2

3.0.3PHP ^7.4|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1406755?v=4)[Daniel Stainback](/maintainers/torann)[@Torann](https://github.com/Torann)

---

Top Contributors

[![Torann](https://avatars.githubusercontent.com/u/1406755?v=4)](https://github.com/Torann "Torann (29 commits)")[![johnwheal](https://avatars.githubusercontent.com/u/3426737?v=4)](https://github.com/johnwheal "johnwheal (1 commits)")

---

Tags

hashidslaravellaravelhashencodedecodehashid

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[hashids/hashids

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

5.5k48.6M278](/packages/hashids-hashids)[vinkla/hashids

A Hashids bridge for Laravel

2.1k13.3M73](/packages/vinkla-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)[delight-im/ids

Short, obfuscated and efficient IDs for PHP

289.5k1](/packages/delight-im-ids)[balping/laravel-hashslug

Package providing a trait to use Hashids on a model

25185.2k2](/packages/balping-laravel-hashslug)[lingxi/hashids

A Hashids bridge for Laravel

183.3k](/packages/lingxi-hashids)

PHPackages © 2026

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