leuverink/eloquent-hashid-binding

A drop in solution for eloquent route model binding with hashid's
5,923 1
Install
composer require leuverink/eloquent-hashid-binding
Latest Version:1.5.0
License:MIT
Last Updated:Jan 17, 2025
Links: GitHub  ·  Packagist
Maintainer: gwleuverink

What this package does

This package obfuscates eloquent model's id's when used in url's. This is really usefull when you don't want to expose id's to the outside world.

The route keys are encoded/decoded on the fly. You can drop this in any Laravel project without the need for migrations.

EXAMPLE
Before domain.test/users/1
After domain.test/users/rvBVv

Installation

composer require leuverink/eloquent-hashid-binding

Basic usage

Simply use the HashidBinding trait in your eloquent model and you're good to go!

namespace App;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Leuverink\HashidBinding\HashidBinding;

class User extends Authenticatable
{
    use HashidBinding;

    //
}

That's it! Check out the docs for more information.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

634,760,849 9,707
laravel/framework

The Laravel Framework.

584,532,650 34,931
laravel/tinker

Powerful REPL for the Laravel framework.

493,838,477 7,443
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

408,553,772 609
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

387,976,821 4,658