PHPackages                             ggmm-one/eloquent-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. [Database &amp; ORM](/categories/database)
4. /
5. ggmm-one/eloquent-hashids

AbandonedLibrary[Database &amp; ORM](/categories/database)

ggmm-one/eloquent-hashids
=========================

Add hashids to your Eloquent models on-the-fly

v1.3.0(5y ago)015MITPHP

Since Sep 19Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ggmm-one/eloquent-hashids)[ Packagist](https://packagist.org/packages/ggmm-one/eloquent-hashids)[ RSS](/packages/ggmm-one-eloquent-hashids/feed)WikiDiscussions master Synced yesterday

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

Eloquent Hashids
================

[](#eloquent-hashids)

Do you want to hide your primary keys in your Laravel app urls?

Add hashids to your Eloquent models on-the-fly. No need for extra database columns.

How to use
----------

[](#how-to-use)

Install it using composer

```
composer require ggmm-one/eloquent-hashids

```

Use the HasHashid trait on your models

```
use Ggmm\Model\HasHashid;

class Car extends Model
{
    use HasHashid;
}

# now your model has a hashid attribute

$car->hashid;

# to find the id from a hashid use decodeHashid

$car->decodeHashid('hashidhere');
```

Note: your model's primary key must be a positive integer

Routing
-------

[](#routing)

To use the hashid on your model's routing use the trait HashidRoutable.

```
use Ggmm\Model\HasHashid;
use Ggmm\Model\HashidRoutable

class Car extends Model
{
    use HasHashid;
    use HashidRoutable
}

# Now instead of a url like https://example.org/car/11/edit
# You will have a url like https://example.org/car/xLq/edit
```

Query builder
-------------

[](#query-builder)

HasHashid provide the useful QueryBuilder-similar methods: findByHashid, findManyByHashid, findOrFailByHashid, findOrNewByHashid.

Advanced
--------

[](#advanced)

If you want to customise the hashid generation, set the hashidGenerator on the constructor. For options, see [vinkla/hashids](https://github.com/vinklahashids).

```
use Hashids\Hashids;

class Car extends Model
{
    use HasHashid;

    public function __constructor()
    {
        $this->hashidGenerator = new Hashids('myhashsaltgoeshere');
    }
}
```

Note: the hashing on this library has no cryptographic value. Do not use to implement any security scheme.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~24 days

Total

5

Last Release

1964d ago

Major Versions

v0.0.1 → v1.0.02020-09-19

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/846074?v=4)[ggmm](/maintainers/ggmm)[@ggmm](https://github.com/ggmm)

---

Top Contributors

[![ggmm-one](https://avatars.githubusercontent.com/u/55441732?v=4)](https://github.com/ggmm-one "ggmm-one (1 commits)")

### Embed Badge

![Health badge](/badges/ggmm-one-eloquent-hashids/health.svg)

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

###  Alternatives

[owen-it/laravel-auditing

Audit changes of your Eloquent models in Laravel

3.4k33.0M95](/packages/owen-it-laravel-auditing)[staudenmeir/eloquent-json-relations

Laravel Eloquent relationships with JSON keys

1.1k5.8M24](/packages/staudenmeir-eloquent-json-relations)[bavix/laravel-wallet

It's easy to work with a virtual wallet.

1.3k1.1M11](/packages/bavix-laravel-wallet)[dragon-code/migrate-db

Easy data transfer from one database to another

15717.4k](/packages/dragon-code-migrate-db)[gearbox-solutions/eloquent-filemaker

A package for getting FileMaker records as Eloquent models in Laravel

6454.8k2](/packages/gearbox-solutions-eloquent-filemaker)[cybercog/laravel-ownership

Laravel Ownership simplify management of Eloquent model's owner.

9126.6k3](/packages/cybercog-laravel-ownership)

PHPackages © 2026

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