Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using vinkla/hashids package in Laravel 5.2

I am using vinkla/hashids and i have followed the following steps

  1. composer require vinkla/hashids
  2. Add the service provider to config/app.php in the providers array
  3. If you want you can use the facade. Add the reference in config/app.php to your aliases array.
  4. php artisan vendor:publish this step does not create hashid.php in config file
  5. use Vinkla\Hashids\Facades\Hashids;
  6. Hashids::encode(4815162342);

And i get error that hashids class not found

like image 599
Awais Mushtaq Avatar asked Sep 18 '25 02:09

Awais Mushtaq


1 Answers

It seems that the provider is not booting.

Try to do this:

php artisan config:clear
php artisan clear-compiled

The first will clear any cached config files, and the later will clear the services cache.

It worked for me, hope it works for you too.

I found the solution here: Laravel 5.2 Service provider not booting

like image 145
Diguin Avatar answered Sep 20 '25 15:09

Diguin