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, 12 and 13

11.1.0(4d ago)042MITPHPPHP &gt;=8.2 &lt;9.0

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 today

READMEChangelog (1)Dependencies (14)Versions (3)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

35

↑

LowBetter than 77% of packages

Maintenance55

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~792 days

Total

2

Last Release

4d ago

PHP version history (2 changes)11.0.2PHP ^8.2|^8.3

11.1.0PHP &gt;=8.2 &lt;9.0

### 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

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M188](/packages/laravel-ai)[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)[illuminate/pagination

The Illuminate Pagination package.

12234.1M1.0k](/packages/illuminate-pagination)[illuminate/pipeline

The Illuminate Pipeline package.

9349.2M278](/packages/illuminate-pipeline)[illuminate/broadcasting

The Illuminate Broadcasting package.

7127.2M208](/packages/illuminate-broadcasting)

PHPackages © 2026

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