PHPackages                             awtechs/laravel-public-ulid - 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. awtechs/laravel-public-ulid

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

awtechs/laravel-public-ulid
===========================

Binary ULID public identifiers for Laravel models

v1.0.1(4mo ago)02MITPHPPHP ^8.2

Since Feb 27Pushed 4mo agoCompare

[ Source](https://github.com/Lordeagle4/Laravel-Public-Ulid)[ Packagist](https://packagist.org/packages/awtechs/laravel-public-ulid)[ RSS](/packages/awtechs-laravel-public-ulid/feed)WikiDiscussions main Synced today

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

Laravel Public ULID
===================

[](#laravel-public-ulid)

Binary ULID public identifiers for Laravel models.

This package stores ULIDs in a compact 16-byte binary column, casts them to their canonical Base32 string form, and makes them suitable for public routes.

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

[](#requirements)

- PHP 8.2+
- Laravel 12+
- `symfony/uid` 7+

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

[](#installation)

```
composer require awtechs/laravel-public-ulid
```

Quick Start
-----------

[](#quick-start)

1. Add the schema macro in a migration:

```
Schema::table('users', function (Blueprint $table) {
    $table->publicUlid();
});
```

2. Add the trait to your model:

```
use Awtechs\PublicUlid\Concerns\HasPublicUlid;

final class User extends Model
{
    use HasPublicUlid;
}
```

Now `public_id` is automatically created as a ULID, stored as binary, and used for route model binding.

How It Works
------------

[](#how-it-works)

- **Binary storage:** `public_id` is a 16-byte binary column.
- **Cast:** `public_id` is cast to a Base32 ULID string via `BinaryUlidCast`.
- **Auto-generation:** on `creating`, if `public_id` is missing, a ULID is set.
- **Route key:** `getRouteKeyName()` returns `public_id`.

Casting
-------

[](#casting)

If you need to customize or reuse the cast directly:

```
use Awtechs\PublicUlid\Casts\BinaryUlidCast;

protected $casts = [
    'public_id' => BinaryUlidCast::class,
];
```

Validation Rule
---------------

[](#validation-rule)

```
use Awtechs\PublicUlid\Rules\ValidUlid;

request()->validate([
    'public_id' => ['required', new ValidUlid()],
]);
```

Console Command
---------------

[](#console-command)

Decode ULID details from the CLI:

```
php artisan ulid:inspect 01HZX9J4P7VWH2T0R0X6Q8N5E3
```

Testing Helpers
---------------

[](#testing-helpers)

```
use Awtechs\PublicUlid\Testing\AssertsUlids;
use Awtechs\PublicUlid\Testing\GeneratesUlids;

final class ExampleTest extends TestCase
{
    use AssertsUlids;
    use GeneratesUlids;

    public function test_ulid_helpers(): void
    {
        $ulid = $this->newUlid();
        $this->assertValidUlid($ulid);
    }
}
```

Add the Faker provider if you need ULIDs in factories:

```
use Awtechs\PublicUlid\Testing\Faker\PublicUlidProvider;

$faker->addProvider(new PublicUlidProvider($faker));
$faker->ulid();
```

Notes
-----

[](#notes)

- The column name is `public_id` by design.
- ULIDs are stored in binary, but are exposed as Base32 strings in PHP.

License
-------

[](#license)

MIT

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance77

Regular maintenance activity

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

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

Every ~0 days

Total

2

Last Release

126d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/18239064?v=4)[Eagle (Mike)](/maintainers/Lordeagle4)[@Lordeagle4](https://github.com/Lordeagle4)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/awtechs-laravel-public-ulid/health.svg)

```
[![Health](https://phpackages.com/badges/awtechs-laravel-public-ulid/health.svg)](https://phpackages.com/packages/awtechs-laravel-public-ulid)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

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

The Illuminate Pagination package.

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

The Illuminate Pipeline package.

9349.2M282](/packages/illuminate-pipeline)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[masterix21/laravel-licensing

Laravel licensing package with polymorphic assignment to any model, activation keys, expirations/renewals, and seat control via LicenseUsage. Supports offline verification with public-key–signed tokens, a CLI to generate/rotate/revoke keys, and an extensible architecture via config and contracts.

1563.1k4](/packages/masterix21-laravel-licensing)

PHPackages © 2026

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