Download the PHP package blake/laraveldoctrine-hashids without Composer
On this page you can find all versions of the php package blake/laraveldoctrine-hashids. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download blake/laraveldoctrine-hashids
More information about blake/laraveldoctrine-hashids
Files in blake/laraveldoctrine-hashids
Package laraveldoctrine-hashids
Short Description Hashid type for Doctrine
License MIT
Homepage https://github.com/blake/laraveldoctrine-hashids
Informations about the package laraveldoctrine-hashids
Laravel Doctrine Hashids
This package uses vinkla's Hashids bridge for Laravel to provide a Doctrine type that obfuscates integer IDs using Hashids.
Installation
Before installing this package, install and configure the vinkla/hashids package.
Require this package using composer:
composer require "blake/laraveldoctrine-hashids:~1.0"
The next step is enabling the Doctrine type. If you are using the laravel-doctrine/orm package, add this to your
config/doctrine.php
file:
Usage
Anywhere you are using an integer in your entities you may safely replace with the hashid
type:
Interacting with the entity manager is as you'd expect. Simply replace where you'd use lame integer IDs with their obfuscated version:
The ID will be decoded before it hits the database, and it will be encoded on the way out. This allows you to use performant integer IDs while obfuscating details about your database and making URLs that point to objects slightly prettier.
Configuration
vinkla/hashids allows you to set up multiple "connections". This package will look for a doctrine
connection and
use main
as a fallback if the doctrine
connection doesn't exist.