leuverink/eloquent-hashid-binding

A drop in solution for eloquent route model binding with hashid's

1.3.0 2021-07-01 13:24 UTC

This package is auto-updated.

Last update: 2022-08-29 02:10:35 UTC


README

package-logo.png

Build Status Coverage Status Latest Stable Version Latest Unstable Version License

A drop in solution for eloquent implicit route model binding with hashid's.
Obfuscate your app's id's from prying eyes.


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.