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

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

alexanderzon/laravel-hashids
============================

Fork from toran/hashids: Laravel package for Hashids

3.0.1(11y ago)099BSD 2-ClausePHPPHP &gt;=5.3.0

Since Sep 11Pushed 11y ago1 watchersCompare

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

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

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

[](#hashids-for-laravel-5)

[![Latest Stable Version](https://camo.githubusercontent.com/4abdb22c7d0a6dcccadf42790a19adbfea43c04d4714bdd6206c7e94af0553ab/68747470733a2f2f706f7365722e707567782e6f72672f616c6578616e6465727a6f6e2f6c61726176656c2d686173686964732f762f737461626c652e706e67)](https://packagist.org/packages/alexanderzon/laravel-hashids) [![Total Downloads](https://camo.githubusercontent.com/f7a8900dabc0b1afc4878f9a2ec4e89bc7d950b8c01408d743ac85955054af91/68747470733a2f2f706f7365722e707567782e6f72672f616c6578616e6465727a6f6e2f6c61726176656c2d686173686964732f646f776e6c6f6164732e706e67)](https://packagist.org/packages/alexanderzon/laravel-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/alexanderzon/laravel-hashids)
- [Hashids on GitHub](https://github.com/alexanderzon/laravel-hashids)
- [Laravel 4 Installation](#user-content-laravel-4-installation)

To get the latest version of Hashids simply require it in your `composer.json` file.

```
"alexanderzon/laravel-hashids": "dev-master"

```

You'll then need to run `composer install` to download it and have the autoloader updated.

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

```
'AlexanderZon\Hashids\HashidsServiceProvider'
```

> There is no need to add the Facade, the package will add it for you.

### Publish the configurations

[](#publish-the-configurations)

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

```
$ php artisan config:publish alexanderzon/laravel-hashids

```

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

Laravel 4 Installation
----------------------

[](#laravel-4-installation)

Add verison 1.0 of Hashids in your `composer.json` file.

```
"alexanderzon/laravel-hashids": "3.0.*"

```

And following the directions in the [README](https://github.com/AlexanderZon/laravel-hashids/tree/1.0.0) on version 1.0.

Usage
-----

[](#usage)

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

### Encodeing

[](#encodeing)

You can simply encode a single id:

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

or multiple..

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

### Decodeing

[](#decodeing)

```
Hashids::decode(Ri7Bi);

// Returns
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
```

Changelog
---------

[](#changelog)

**2.0.0**

- Upgraded to Laravel 5
- Upgraded to Hashids 1.0.5

**1.0.0**

- Several public functions are renamed to be more appropriate:

    - Function `encrypt()` changed to `encode()`
    - Function `decrypt()` changed to `decode()`
    - Function `encryptHex()` changed to `encodeHex()`
    - Function `decryptHex()` changed to `decodeHex()`

    Hashids was designed to encode integers, primary ids at most. Hashids is the wrong algorithm to encrypt sensitive data. So to encourage more appropriate use, `encrypt/decrypt` is being "downgraded" to `encode/decode`.
- Version tag added: `1.0`
- `README.md` updated

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

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 61.5% 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 ~52 days

Total

5

Last Release

4051d ago

Major Versions

0.3.1 → 1.0.02014-09-11

1.0.0 → 2.0.02015-02-15

2.0.0 → 3.0.02015-04-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/8861665793825350cfd08ab6f462ed3a281253762d5bf4f5e785f7b58375754c?d=identicon)[AlexanderZon](/maintainers/AlexanderZon)

---

Top Contributors

[![AlexanderZon](https://avatars.githubusercontent.com/u/5555468?v=4)](https://github.com/AlexanderZon "AlexanderZon (16 commits)")[![Torann](https://avatars.githubusercontent.com/u/1406755?v=4)](https://github.com/Torann "Torann (10 commits)")

---

Tags

laravelencryptdecrypthashhashid

### Embed Badge

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

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

###  Alternatives

[hashids/hashids

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

5.5k48.6M278](/packages/hashids-hashids)[cybercog/laravel-optimus

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

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

Laravel package for Hashids

54335.1k](/packages/torann-hashids)[light/hashids

Hashids for Yii2

1120.2k](/packages/light-hashids)[lingxi/hashids

A Hashids bridge for Laravel

183.3k](/packages/lingxi-hashids)[jiaxincui/hashid

Laravel ID Encrypt Helper

2410.8k](/packages/jiaxincui-hashid)

PHPackages © 2026

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