Encode and decode integers with your own specified base!
elliottlan/laravel-baser is a Laravel package for encode and decode integers with your own specified base!.
It currently has 1 GitHub stars and 31 downloads on Packagist (latest version 1.2).
Install it with composer require elliottlan/laravel-baser.
Discover more Laravel packages by elliottlan
or browse all Laravel packages to compare alternatives.
Last updated
View the package at packagist.org
composer require elliottlan/laravel-baser
Elliottlan\LaravelBaser\LaravelBaserServiceProvider::class,
'Baser' => Elliottlan\LaravelBaser\Facades\Baser::class,
use Baser;
echo Baser::getTokenFromInt(436432278698); // 7GnTmBA
echo Baser::getTokenFromInt(436432278698); // 7GnTmBA
echo Baser::getIntFromToken('7GnTmBA'); // 436432278698
// calculate above the 32bit limit on old machines
echo Baser::bcMath()->getTokenFromInt(19598531548); // lolrly
echo Baser::bcMath()->getIntFromToken('lolrly'); // 19598531548
// set codeset to 'ABCEFGHKMNPRSTUVW1235789'
echo Baser::setCodeset('ABCEFGHKMNPRSTUVW1235789')->getTokenFromInt(646464); // B82MA
echo Baser::setCodeset('ABCEFGHKMNPRSTUVW1235789')->getIntFromToken('B82MA'); // 646464
echo Baser::setCodeset('ABC')->bcMath()->getTokenFromInt(1337);