PHPackages                             trianity/laravel-sqids - 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. trianity/laravel-sqids

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

trianity/laravel-sqids
======================

A Hashids / Sqids bridge for Laravel 10,11

11.0.2(2y ago)041MITPHPPHP ^8.2|^8.3

Since Apr 26Pushed 2y ago1 watchersCompare

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

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

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

[](#laravel-sqids---hashids)

A Sqids, Hashids bridge for Laravel.

This package uses the classes created by sqids.org

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

**Sqids** (pronounced "squids") is a small library that lets you generate unique IDs from numbers. It's good for link shortening, fast &amp; URL-safe ID generation and decoding back into numbers for quicker database lookups.

Features:
---------

[](#features)

- Encode multiple numbers - generate short IDs from one or several non-negative numbers
- Quick decoding - easily decode IDs back into numbers
- Unique IDs - generate unique IDs by shuffling the alphabet once
- ID padding - provide minimum length to make IDs more uniform
- URL safe - auto-generated IDs do not contain common profanity
- Randomized output - Sequential input provides nonconsecutive IDs

Use-cases
---------

[](#use-cases)

### Good for:

[](#good-for)

- Generating IDs for public URLs (eg: link shortening)
- Generating IDs for internal systems (eg: event tracking)
- Decoding for quicker database lookups (eg: by primary keys)

### Not good for:

[](#not-good-for)

- Sensitive data (this is not an encryption library)
- User IDs (can be decoded revealing user count)

### Note

[](#note)

🚧 Because of the algorithm's design, multiple IDs can decode back into the same sequence of numbers. If it's important to your design that IDs are canonical, you have to manually re-encode decoded numbers and check that the generated ID matches.

---

// Encode integers. `Sqids::encode(4815162342); //result: "kRN2UomKT9MV"`

// Decode strings. `Sqids::decode('1LLb3b4ck');  //result: array [0 => 111843073722887]`

// Other example. `$sqids = new SqidsFactory();``$sqids->encode(911); //result: "tcOyJwvFCuKy"`

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

[](#installation)

Require this package, with Composer, in the root directory of your project.

`composer require trianity/laravel-sqids`

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

[](#configuration)

Laravel Sqids no need any configuration. But you can publish the vendor assets:

`$ php artisan vendor:publish --tag=config-sqids`This will create a config/sqids.php file in your app that you can modify to set your configuration.

Usage
-----

[](#usage)

Here you can see an example of you may use this package.

// You can alias this in config/app.php. `use Trianity\Sqids\Facades\Sqids;`

// We're done here - how easy was that, it just works! `Sqids::encode(4815162342);`

// This example is simple: `Sqids::decode('wellthatsreallyahugething'); //result: [0 => 9223372036854775807]``Sqids::encode(9223372036854775807);`

If you prefer to use dependency injection over facades, then you can inject the manager:

```
use Trianity\Sqids\SqidsFactory;

class Foo
{
    protected $sqids;

    public function __construct(SqidsFactory $sqids)
    {
        $this->sqids = $sqids;
    }

    public function bar(array $id)s
    {
        $this->sqids->encode($ids);
    }
}

App::make('Foo')->bar();

```

For more information on how to use the Sqids\\Sqids class, check out the docs at [sqids/sqids](https://github.com/sqids/sqids-php).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Unknown

Total

1

Last Release

746d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6353141?v=4)[István Holbok](/maintainers/trianity)[@trianity](https://github.com/trianity)

---

Top Contributors

[![trianity](https://avatars.githubusercontent.com/u/6353141?v=4)](https://github.com/trianity "trianity (3 commits)")

---

Tags

laravelhashidssqids

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/trianity-laravel-sqids/health.svg)

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

###  Alternatives

[vinkla/hashids

A Hashids bridge for Laravel

2.1k13.3M73](/packages/vinkla-hashids)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[cybercog/laravel-optimus

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

192564.1k](/packages/cybercog-laravel-optimus)[red-explosion/laravel-sqids

Easily generate Stripe/YouTube looking IDs for your Laravel models.

4530.8k](/packages/red-explosion-laravel-sqids)[bensampo/laravel-embed

Painless responsive embeds for videos, slideshows and more.

142146.8k](/packages/bensampo-laravel-embed)[dragon-code/pretty-routes

Pretty Routes for Laravel

10058.7k4](/packages/dragon-code-pretty-routes)

PHPackages © 2026

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