2017 © Pedro Peláez
 

library laravel-baser

Encode and decode integers with your own specified base!

image

elliottlan/laravel-baser

Encode and decode integers with your own specified base!

  • Monday, September 18, 2017
  • by elliottlan
  • Repository
  • 1 Watchers
  • 1 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Laravel Baser

Base encode and decode integers with your own specified base

View the package at packagist.org, (*1)

Requirements

  • Laravel
  • PHP

Limits

  • Currently only supports integers from 1 to 100000000000000000000000000000 (on 64 bit machines)

Installation

  1. Include the composer package
composer require elliottlan/laravel-baser
  1. Add this line to 'Providers' in config/app.php
Elliottlan\LaravelBaser\LaravelBaserServiceProvider::class,
  1. Add this line to 'Aliases' in config/app.php
'Baser' => Elliottlan\LaravelBaser\Facades\Baser::class,
  1. Use 'Base' at the top of a controller
use Baser;
  1. Try an example out
echo Baser::getTokenFromInt(436432278698); // 7GnTmBA

Usage examples

Encode an int
echo Baser::getTokenFromInt(436432278698); // 7GnTmBA
Decode a token
echo Baser::getIntFromToken('7GnTmBA'); // 436432278698
Use big maths (requires php-bcmath)
// calculate above the 32bit limit on old machines
echo Baser::bcMath()->getTokenFromInt(19598531548); // lolrly
echo Baser::bcMath()->getIntFromToken('lolrly'); // 19598531548
Define a codeset and encode/decode
// set codeset to 'ABCEFGHKMNPRSTUVW1235789'
echo Baser::setCodeset('ABCEFGHKMNPRSTUVW1235789')->getTokenFromInt(646464); // B82MA
echo Baser::setCodeset('ABCEFGHKMNPRSTUVW1235789')->getIntFromToken('B82MA'); // 646464
Everything
echo Baser::setCodeset('ABC')->bcMath()->getTokenFromInt(1337);
Simple URL Shortening service using this package

Controller Model Migration, (*2)

The Versions

18/09 2017

dev-master

9999999-dev

Encode and decode integers with your own specified base!

  Sources   Download

MIT

The Requires

 

by Elliott Landsborough

laravel base encode

18/09 2017

1.1

1.1.0.0

Encode and decode integers with your own specified base!

  Sources   Download

MIT

The Requires

 

by Elliott Landsborough

laravel base encode

08/03 2015

0.0.1

0.0.1.0

Encode and decode integers with your own specified base!

  Sources   Download

MIT

The Requires

 

by Elliott Landsborough

laravel base encode

08/03 2015

1.0

1.0.0.0

Encode and decode integers with your own specified base!

  Sources   Download

MIT

The Requires

 

by Elliott Landsborough

laravel base encode