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

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

antoninmasek/laravel-hashids
============================

Simple Laravel wrapper around Hashids library.

1.1.0(11mo ago)09.5k↓42%11MITPHPPHP ^8.1CI passing

Since Jul 23Pushed 11mo ago1 watchersCompare

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

READMEChangelog (4)Dependencies (7)Versions (5)Used By (1)

Simple Laravel wrapper around Hashids library
=============================================

[](#simple-laravel-wrapper-around-hashids-library)

[![Packagist Version](https://camo.githubusercontent.com/e29b22da6b421b873128a9d0c5a809298f6b8f08b14b5619ffd74fecbb3f7cb6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616e746f6e696e6d6173656b2f6c61726176656c2d686173686964733f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/e29b22da6b421b873128a9d0c5a809298f6b8f08b14b5619ffd74fecbb3f7cb6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616e746f6e696e6d6173656b2f6c61726176656c2d686173686964733f7374796c653d666c61742d737175617265)[![GitHub Actions Tests Workflow Status](https://camo.githubusercontent.com/42cb605e363f83efd6929855c4609a67b78de4b1309f8952a0d2edb738bb7680/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616e746f6e696e6d6173656b2f6c61726176656c2d686173686964732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265266c6162656c3d7465737473)](https://camo.githubusercontent.com/42cb605e363f83efd6929855c4609a67b78de4b1309f8952a0d2edb738bb7680/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616e746f6e696e6d6173656b2f6c61726176656c2d686173686964732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265266c6162656c3d7465737473)[![Packagist Downloads](https://camo.githubusercontent.com/c0856d01e9b822923d463e4c396e28520544d38cb3d722cd15d8371676de98c4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616e746f6e696e6d6173656b2f6c61726176656c2d686173686964733f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/c0856d01e9b822923d463e4c396e28520544d38cb3d722cd15d8371676de98c4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616e746f6e696e6d6173656b2f6c61726176656c2d686173686964733f7374796c653d666c61742d737175617265)

This package introduces a simple fluent interface for [Hashids](https://hashids.org/php/) package.

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

[](#installation)

You can install the package via composer:

```
composer require antoninmasek/laravel-hashids
```

You can publish the config file with:

```
php artisan vendor:publish --tag="hashids-config"
```

This is the contents of the published config file:

```
return [
    /**
     * If you wish to globally redefine the default alphabet you may do so below. If set to
     * null, then the default value defined in the Hashids library is used.
     *
     * Please make sure your alphabet has at least 16 characters as that is the minimum
     * length of the alphabet the Hashids package requires.
     *
     * The default alphabet choice only includes capital letters, that is to prevent
     * possible issues with case-insensitive collations in databases.
     *
     * @see \Hashids\Hashids::__construct
     */
    'alphabet' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890',

    /**
     * If you wish to globally redefine the default salt you may do so below. If set to
     * null, then the default value defined in the Hashids library is used.
     *
     * @see \Hashids\Hashids::__construct
     */
    'salt' => null,

    /**
     * If you wish to globally redefine the default minimum length of the hash you may do so
     * below. If set to null, then the default value defined in the Hashids library is used.
     *
     * Please note, that this is minimum length and not exact length. This means, that if
     * you specify, for example, 5 the resulting hash id can have length of 5 characters
     * or more.
     *
     * @see \Hashids\Hashids::__construct
     */
    'min_length' => null,
];
```

Usage
-----

[](#usage)

```
use AntoninMasek\Hashids\Facades\Hashids;

Hashids::encode(1);
Hashids::decode('jR');

// With configuration
Hashids::alphabet('1234567890qwertz')->encode(1);
Hashids::salt('your-salt')
    ->minLength(10)
    ->encode(1)
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

[Antonín Mašek](https://github.com/antoninmasek)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Special thanks
--------------

[](#special-thanks)

- To [Spatie](https://spatie.be/) for their amazing [skeleton](https://github.com/spatie/package-skeleton-laravel) which I used to scaffold this repository.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance51

Moderate activity, may be stable

Popularity24

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.8% 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 ~351 days

Total

4

Last Release

341d ago

Major Versions

0.2.0 → 1.0.02024-04-01

PHP version history (3 changes)0.1.0PHP ^8.0|^8.1

0.2.0PHP ^8.1 || ^8.2

1.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/8faef5fac979c7f7fa3622af216db9734384499fa3890e62e9f6e97b421b204f?d=identicon)[antoninmasek](/maintainers/antoninmasek)

---

Top Contributors

[![antoninmasek](https://avatars.githubusercontent.com/u/31475951?v=4)](https://github.com/antoninmasek "antoninmasek (15 commits)")[![sweptsquash](https://avatars.githubusercontent.com/u/9886472?v=4)](https://github.com/sweptsquash "sweptsquash (1 commits)")

---

Tags

laravelLaravel-hashidsantoninmasek

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.8k28.9M627](/packages/spatie-laravel-data)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

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