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(1mo ago)042MITPHPPHP &gt;=8.2 &lt;9.0CI passing

Since Apr 26Pushed 1mo 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 2w ago

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

Laravel Sqids
=============

[](#laravel-sqids)

A small Hashids / Sqids bridge for Laravel. It wraps [`sqids/sqids`](https://github.com/sqids/sqids-php) and exposes a Laravel service provider and facade.

Sqids generate short, URL-safe IDs from non-negative integers and can decode them back to the original numbers. They are useful for public URLs where exposing database IDs is undesirable. Sqids are not encryption and should not be used for sensitive data.

Requirements
------------

[](#requirements)

LaravelPHP10.x8.2+11.x8.2+12.x8.2+13.x8.3+Laravel 13 requires PHP 8.3 or newer through Laravel's own dependency constraints.

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

[](#installation)

```
composer require trianity/laravel-sqids
```

The package is auto-discovered by Laravel.

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

[](#configuration)

Publishing the config file is optional:

```
php artisan vendor:publish --provider="Trianity\Sqids\Providers\PackageServiceProvider"
```

You can also publish by tag:

```
php artisan vendor:publish --tag=config-sqids
```

The published `config/sqids.php` file contains:

```
return [
    'minLength' => 12,
    'alphabet' => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890',
    'blocklist' => [
        // 'word',
    ],
];
```

Usage
-----

[](#usage)

Use the facade:

```
use Trianity\Sqids\Facades\Sqids;

$id = Sqids::encode([4815162342]);

$numbers = Sqids::decode($id);
```

Use dependency injection:

```
use Trianity\Sqids\SqidsFactory;

final class LinkController
{
    public function show(SqidsFactory $sqids, string $id): array
    {
        return $sqids->decode($id);
    }
}
```

Create a custom instance when you need a different alphabet, minimum length, or blocklist:

```
use Trianity\Sqids\SqidsFactory;

$sqids = new SqidsFactory(minLength: 24);

$id = $sqids->encode([1, 2, 3]);
```

Upgrade From 11.0.2
-------------------

[](#upgrade-from-1102)

No application code changes are required when upgrading from `11.0.2`.

This release expands Composer constraints for Laravel 12 and Laravel 13, keeps Laravel 10 and Laravel 11 compatibility, removes the static `version` field from `composer.json`, and keeps the existing service provider, facade, config keys, and public namespace unchanged.

Recommended upgrade command:

```
composer require trianity/laravel-sqids:^11.1 -W
```

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance90

Actively maintained with recent releases

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

49d 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 (6 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

3345.4M354](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

1.1k4.6M315](/packages/laravel-ai)[moonshine/moonshine

Laravel administration panel

1.3k268.2k89](/packages/moonshine-moonshine)[nativephp/mobile

NativePHP for Mobile

1.1k102.1k144](/packages/nativephp-mobile)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1239.7k25](/packages/fleetbase-core-api)

PHPackages © 2026

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