Download the PHP package alesitom/hybrid-id-laravel without Composer
On this page you can find all versions of the php package alesitom/hybrid-id-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alesitom/hybrid-id-laravel
More information about alesitom/hybrid-id-laravel
Files in alesitom/hybrid-id-laravel
Package hybrid-id-laravel
Short Description Laravel integration for HybridId — Eloquent trait, service provider, and config
License MIT
Informations about the package hybrid-id-laravel
HybridId for Laravel
Laravel integration for HybridId — compact, time-sortable unique IDs as a drop-in UUID replacement for Eloquent models.
Installation
The service provider is auto-discovered. No manual registration needed.
Quick Start
Add the HasHybridId trait to any model:
That's it. New models automatically get a HybridId on creation:
Migration
Your primary key column must be a string, not an auto-incrementing integer:
Use ascii_bin collation on MySQL/MariaDB to preserve case-sensitive ordering. See core docs for details.
Configuration
Publish the config file:
This creates config/hybrid-id.php:
Set HYBRID_ID_REQUIRE_NODE=1 in production to enforce explicit node assignment.
Blind Mode
Enable blind mode to HMAC-hash timestamps and node info, making creation time unextractable:
Generate a secret: php -r "echo base64_encode(random_bytes(32)) . PHP_EOL;"
See Blind Mode docs for details.
Dependency Injection
The service provider binds IdGenerator as a singleton. Inject it anywhere:
Prefixes
Set $idPrefix on your model for Stripe-style self-documenting IDs:
Omit $idPrefix for unprefixed IDs.
How It Works
HasHybridIdhooks into Eloquent'screatingevent- Sets
$keyType = 'string'and$incrementing = falseautomatically - If the model's primary key is empty at creation time, generates a HybridId
- If the primary key is already set (e.g., manual assignment), it is not overwritten
- The generator instance is resolved from the container (singleton)
Requirements
- PHP 8.3, 8.4, or 8.5
- Laravel 11 or 12
- alesitom/hybrid-id ^4.1 (installed automatically)
License
MIT
All versions of hybrid-id-laravel with dependencies
alesitom/hybrid-id Version ^4.4
illuminate/database Version ^11.0|^12.0
illuminate/support Version ^11.0|^12.0