New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

kduma/eloquent-tokenable

Allows using tokens (HashIDs) instead of id in Laravel Eloquent models.
176 6
Install
composer require kduma/eloquent-tokenable
Latest Version:v3.0.0
PHP:^8.3
Laravel:13
Older releases:5 – 11
License:MIT
Last Updated:Apr 8, 2026
Links: GitHub  ·  Packagist
Maintainer: kduma

Eloquent Tokenable

Latest Stable Version Total Downloads License

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

nanokaweb/eloquent-tokenable

Allows using tokens (HashIDs) instead of id in Laravel Eloquent models.

11 0
envivolink/eloquent-hashids

Automatically generate hashids in Laravel for a new Eloquent Model.

10,889 0
rossbearman/eloquent-calamari

Obfuscate incrementing IDs with Sqids for Laravel and Eloquent.

8,394 4
naabster/laravel-eloquent-hashids

Automatically generate hashids in Laravel for a new Eloquent Model.

7,045 16
veelasky/laravel-hashid

HashId Implementation on Laravel Eloquent ORM

250,798 48

Version History

Version Released PHP Laravel License
v3.0.0 ^8.3 ^13.0 MIT
v1.2.0 >=7.4 7.*|8.*|9.*|10.*|11.* MIT
v1.1.2 >=5.4.0 5.*|^6.0|^7.0|^8.0 MIT
v1.1.1 >=5.4.0 5.* MIT
v1.1.0 >=5.4.0 5.* MIT