hashids

$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.

hashids – generate short unique ids from integers →

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.