kduma/eloquent-tokenable
Eloquent Tokenable
Eloquent trait for exposing Hashids-based tokens on Laravel models instead of numeric IDs.
Full documentation: opensource.duma.sh/libraries/php/eloquent-tokenable
Requirements
- PHP
^8.3 - Laravel
^13.0
Installation
composer require kduma/eloquent-tokenable
Usage
use KDuma\Eloquent\Tokenable;
use KDuma\Eloquent\Attributes\HasToken;
#[HasToken(length: 10)]
class Order extends Model
{
use Tokenable;
}
$order = Order::find(1);
echo $order->token; // e.g. "k3Zx9mPqW2"
$order = Order::whereToken('k3Zx9mPqW2')->first();
Related Packages
naabster/laravel-eloquent-hashids
Automatically generate hashids in Laravel for a new Eloquent Model.
7,045
16
nanokaweb/eloquent-tokenable
Allows using tokens (HashIDs) instead of id in Laravel Eloquent models.
11
0
cline/strongly-typed-id
Strongly-typed ID value objects for PHP with support for UUID, ULID, NanoID, GUI...
9,691
0
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v3.0.0 | ^8.3 | ^13.0 | MIT | |
| v1.2.0 | >=7.4 | 7.*| | MIT | |
| v1.1.2 | >=5.4.0 | 5.*| | MIT | |
| v1.1.1 | >=5.4.0 | 5.* | MIT | |
| v1.1.0 | >=5.4.0 | 5.* | MIT | |
| v1.0.3 | >=5.4.0 | 5.0.* | MIT | |
| v1.0.2 | >=5.4.0 | 5.0.* | MIT | |
| v1.0.1 | >=5.4.0 | 5.0.* | MIT | |
| v1.0.0 | >=5.4.0 | 5.0.* | MIT |