Posts Tagged “extending”

Laravel + Hashids

Everyone nowadays used youtube or any short link creator. If you look to the links they use (eg. you will notice that they use unique string hashes instead of common auto-increment ids. They do it because anyone can just iterate ids and get access to all their content. And of course they don’t want it.

If you want to protect your content too, you have to replace your ids with hashes. There are lots of tools that can convert integers to unique hash ids. They work practically identically, and I will show how to integrate one of them Hashids with Laravel.

There are lots of packages that already integrate Hashids into Laravel, but they only add it’s facade and give some syntactic sugar. But we need complex integration with easy model binding and all logic under the hood! So let’s do the magic!

Read More