PHPackages                             lanin/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. [Framework](/categories/framework)
4. /
5. lanin/laravel-hashids

ActiveLibrary[Framework](/categories/framework)

lanin/laravel-hashids
=====================

Integrate Hashids with Laravel.

0.1.1(10y ago)103923[2 issues](https://github.com/mlanin/laravel-hashids/issues)MITPHPPHP &gt;=5.4.0

Since Oct 5Pushed 10y ago1 watchersCompare

[ Source](https://github.com/mlanin/laravel-hashids)[ Packagist](https://packagist.org/packages/lanin/laravel-hashids)[ RSS](/packages/lanin-laravel-hashids/feed)WikiDiscussions master Synced 3w ago

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

Laravel-Hashids
===============

[](#laravel-hashids)

> Easily integrate Laravel with Hashids with full model support.

There are lots of packages for integrating Hashids with Laravel, but all of them just provide you with facade and add some syntax sugar.

But what about model binding and automatic id resolving? This package gives you all. All you have to do is just to install it!

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

[](#installation)

[PHP](https://php.net) 5.4+ or [HHVM](http://hhvm.com) 3.3+, [Composer](https://getcomposer.org) and [Laravel](http://laravel.com) 5.0+ are required.

To get the latest version of Laravel Laravel-Hashids, simply install it via composer.

```
$ composer require lanin/laravel-hashids
```

Once Laravel-Hashids is installed, you need to register the service provider. Open up `config/app.php` and add the following to the providers key.

```
Lanin\Laravel\Hashids\HashidsServiceProvider::class,
```

The last thing is to add `\Lanin\Laravel\Hashids\UseHashidsRouter` trait to your `App\Http\Kernel`. This will force Laravel to use package router to dispatch the route.

```
namespace App\Http;

class Kernel extends HttpKernel
{
    use \Lanin\Laravel\Hashids\UseHashidsRouter;

    ...
}
```

Also you can register `HashidsFacade` for easier access to the Hashids methods.

```
'Hashids' => Lanin\Laravel\Hashids\HashidsFacade::class,
```

Usage
-----

[](#usage)

You don't have to modify anything in your routes or html to make it run. If you are using model bindings and route resolving in html, everything will convert automatically.

### Binding

[](#binding)

After the installation, Router's method `model` that binds your placeholders ids to the models will be updated to automatically support hashids and convert them to the internal integer ids.

### Routing

[](#routing)

If you will pass hash id to the url it will be easily resolved into an associated model. But how replace ids in your html output? There are two ways. Everything depends on how you form your urls.

If you prefer form them by hands, package gives you the Blade helper method `@hashids($id)` that will convert your id to the hash string.

```
{{$post->title}}
```

But this method is tedious. And I prefer using awesome Laravel feature that automatically extracts ids from models and inserts them into your urls. Example:

```
route('page.show', $page);
url('page', ['id' => $page]);
```

This methods were updated to handle Hashids too. They will automatically replace integer ids from your models to Hashids.

> If for some reason you don't want to convert them, just implement `\Lanin\Laravel\Hashids\DoNotUseHashids` interface in your model.

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

[](#configuration)

By default package will use your `APP_KEY` as a salt and 5 symbols length for the hash. If you want to overwrite it, publish hashids configs and edit `config/hahshids.php`

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

Contributing
------------

[](#contributing)

Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

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

Every ~10 days

Total

2

Last Release

3906d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/968784dc2366d12ce2bd6e0b7beaa7ab3cd65ae526401f7840c057c51f5687fe?d=identicon)[lanin](/maintainers/lanin)

---

Tags

hashidslaravelframeworklaravelrouterhashids

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.1k91.3M280](/packages/laravel-horizon)[laravel/sail

Docker files for running a basic Laravel application.

1.9k199.2M1.2k](/packages/laravel-sail)[laravel/ai

The official AI SDK for Laravel.

9782.1M162](/packages/laravel-ai)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

76518.2M120](/packages/laravel-mcp)[graham-campbell/digitalocean

DigitalOcean Is A DigitalOcean Bridge For Laravel

503357.0k2](/packages/graham-campbell-digitalocean)[graham-campbell/bitbucket

Bitbucket Is A Bitbucket Bridge For Laravel

76191.5k2](/packages/graham-campbell-bitbucket)

PHPackages © 2026

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