Require this package, with Composer, in the root directory of your project.
composer require swiggles/laravel-hashids
Add the service provider to config/app.php in the providers array.
If you want you can use the facade. Add the reference in config/app.php to your aliases array.
'Hashids' => 'Swiggles\Hashids\Facades\Hashids'
Laravel Hashids configuration can be customised if necessary. Publish the vendor assets to do so:
php artisan vendor:publish
This will create a config/hashids.php file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.
This is the interface used for dependency injection. It is bound to the Swiggles\Hashids\Hashids class and the hashids alias.
This is the class wrapping Hashids\Hashids which is part of the Hashids package.
It is bound to the ioc container as hashids and can be accessed using the Facades\Hashids facade.
This class contains no public methods of interest. This class should be added to the providers array in config/app.php. This class will setup ioc bindings.
Here you can see an example of just how simple this package is to use.
// You can alias this in config/app.php.useSwiggles\Hashids\Facades\Hashids;
More functionality is available. The Facade will behave like it is an instance of Swiggles\Hashids\Hashids.
If you prefer to use dependency injection over facades like me, then you can inject the Swiggles\Hashids\HashGenerator interface directly: