PHPackages                             elfsundae/laravel-hashid-uuid - 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. elfsundae/laravel-hashid-uuid

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

elfsundae/laravel-hashid-uuid
=============================

Shorten UUID encoding for Laravel Hashid.

1.1.0(4y ago)132.7k5MITPHPPHP ~7.1|~8.0CI failing

Since Nov 11Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ElfSundae/laravel-hashid-uuid)[ Packagist](https://packagist.org/packages/elfsundae/laravel-hashid-uuid)[ Docs](https://github.com/ElfSundae/laravel-hashid-uuid)[ RSS](/packages/elfsundae-laravel-hashid-uuid/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (4)Versions (6)Used By (0)

Laravel Hashid UUID
===================

[](#laravel-hashid-uuid)

[![Latest Version on Packagist](https://camo.githubusercontent.com/95d8a95760bb8bcc636c64d47d8050e4a1327e78d5a8c89c04c7d8e56543eb58/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c6673756e6461652f6c61726176656c2d6861736869642d757569642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/elfsundae/laravel-hashid-uuid)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![tests](https://github.com/ElfSundae/laravel-hashid-uuid/actions/workflows/tests.yml/badge.svg)](https://github.com/ElfSundae/laravel-hashid-uuid/actions/workflows/tests.yml)[![StyleCI](https://camo.githubusercontent.com/c1fb4172567f98badbc48b4aec280428bf41f02728741f6a7296353fc232bc4e/68747470733a2f2f7374796c6563692e696f2f7265706f732f3131303236323837322f736869656c64)](https://styleci.io/repos/110262872)[![SymfonyInsight Grade](https://camo.githubusercontent.com/95edefadb877fc97bf6afcc241f9fcf6ecaab6675f68990f87d2ab1f1098c2b8/68747470733a2f2f696d672e736869656c64732e696f2f73796d666f6e792f692f67726164652f35376132303765312d663835322d343263342d383236302d6130373862376466663964663f7374796c653d666c61742d737175617265)](https://insight.symfony.com/projects/57a207e1-f852-42c4-8260-a078b7dff9df)[![Quality Score](https://camo.githubusercontent.com/a97ca80c4de04b6a1af66f03b8cc6ea833ac32227e6e876a3b0e06816f7d47ec/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f456c6653756e6461652f6c61726176656c2d6861736869642d757569642e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/ElfSundae/laravel-hashid-uuid)[![Code Coverage](https://camo.githubusercontent.com/eab2fac2458507ac9df4f02f6bb4e083f074e052b1a021f22a919f424555a445/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f456c6653756e6461652f6c61726176656c2d6861736869642d757569642f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/ElfSundae/laravel-hashid-uuid/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/a7b809f6b85136ab5a33414ffc09c84e0761a7beb7c53ecc0dbb17a0ba77631e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656c6673756e6461652f6c61726176656c2d6861736869642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/elfsundae/laravel-hashid)

This is a plugin package for [Laravel Hashid](https://github.com/ElfSundae/laravel-hashid), it provides an `uuid` hashid driver to shorten your [UUID](https://github.com/ramsey/uuid) encoding.

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

[](#installation)

You can install this package using the [Composer](https://getcomposer.org) manager:

```
$ composer require elfsundae/laravel-hashid-uuid
```

For Lumen or earlier Laravel than v5.5, you need to register the service provider manually:

```
ElfSundae\Laravel\Hashid\UuidServiceProvider::class,
```

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

[](#configuration)

- Driver name: `uuid`
- Configuration:
    - `connection` : The hashid connection name for encoding and decoding.

**Example:**

```
'connections' => [

    'uuid_base62' => [
        'driver' => 'uuid',
        'connection' => 'base62',
    ],

    'uuid_hashids' => [
        'driver' => 'uuid',
        'connection' => 'hashids_string',
    ],

    // ...
],
```

Usage
-----

[](#usage)

- `encode($data)` accepts a [`Ramsey\Uuid\Uuid`](https://github.com/ramsey/uuid) instance or an UUID string.
- `decode($data)` returns a [`Ramsey\Uuid\Uuid`](https://github.com/ramsey/uuid) instance.

**Example:**

```
use Ramsey\Uuid\Uuid;

$string = 'cd79e206-c715-11e7-891d-8bf37117635e';
$uuid = Uuid::fromString($string);
$hex = $uuid->getHex();                 // "cd79e206c71511e7891d8bf37117635e"

// Encode using the original connections:
hashid_encode($uuid, 'base62');         // "1mUcj8TfpKB7vEBlRecZ4PADhnE1UbBg2L9n3PQOSFqzYZHwj"
hashid_encode($uuid, 'hashids_string'); // "Wr3xrA2WWEh4K1LBBV6vhXL592VVQoSKWnpQB5vkt9DkZxDp6Lsjz945vnRl"

// Encode using the "uuid" driver:
hashid_encode($uuid, 'uuid_base62');    // "6Fj7unqIaNKkq5zbJo1HJ8"
hashid_encode($string, 'uuid_base62');  // "6Fj7unqIaNKkq5zbJo1HJ8"
hashid_encode($hex, 'uuid_base62');     // "6Fj7unqIaNKkq5zbJo1HJ8"
hashid_encode($uuid, 'uuid_hashids');   // "kp2wZkXOBzSMNA3nPxNzSOZJ701"

// Decode
$decoded = hashid_decode('6Fj7unqIaNKkq5zbJo1HJ8', 'uuid_base62');
(string) $decoded;                               // "cd79e206-c715-11e7-891d-8bf37117635e"
$decoded->getDateTime()->format('Y-m-d H:i:s');  // "2017-11-11 19:23:31"

// Decoding failure
(string) hashid_decode('foobar', 'uuid_base62'); // "00000000-0000-0000-0000-000000000000"
```

Testing
-------

[](#testing)

```
$ composer test
```

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT License](LICENSE.md).

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 97.1% 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 ~390 days

Total

5

Last Release

1595d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.6.4

1.1.0PHP ~7.1|~8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/526008?v=4)[Elf Sundae](/maintainers/ElfSundae)[@ElfSundae](https://github.com/ElfSundae)

---

Top Contributors

[![ElfSundae](https://avatars.githubusercontent.com/u/526008?v=4)](https://github.com/ElfSundae "ElfSundae (33 commits)")[![vpratfr](https://avatars.githubusercontent.com/u/2526465?v=4)](https://github.com/vpratfr "vpratfr (1 commits)")

---

Tags

laravelhashiduuidshort

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/elfsundae-laravel-hashid-uuid/health.svg)

```
[![Health](https://phpackages.com/badges/elfsundae-laravel-hashid-uuid/health.svg)](https://phpackages.com/packages/elfsundae-laravel-hashid-uuid)
```

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

23.9k69.5k](/packages/grumpydictator-firefly-iii)[pocketmine/pocketmine-mp

A server software for Minecraft: Bedrock Edition written in PHP

3.5k78.3k90](/packages/pocketmine-pocketmine-mp)[firefly-iii/data-importer

Firefly III Data Import Tool.

8045.8k](/packages/firefly-iii-data-importer)

PHPackages © 2026

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