View the package at packagist.org
- Laravel
- PHP
- Currently only supports integers from 1 to 100000000000000000000000000000 (on 64 bit machines)
- Include the composer package
composer require elliottlan/laravel-baser
- Add this line to 'Providers' in config/app.php
Elliottlan\LaravelBaser\LaravelBaserServiceProvider::class,
- Add this line to 'Aliases' in config/app.php
'Baser' => Elliottlan\LaravelBaser\Facades\Baser::class,
- Use 'Base' at the top of a controller
use Baser;
- Try an example out
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);