$hashids = new Hashids\Hashids('this is my salt'); $id = $hashids->encode(1, 2, 3); $numbers = $hashids->decode($id);
Hashids is a small open-source library that generates short, unique, non-sequential ids from numbers.
You give it a 347 and it gives back “yr8”, you give it a [27, 986] and it returns “3kTMd”.
You can also decode those ids back. This is useful in bundling several parameters into one or simply using them as short unique strings.