2017 © Pedro Peláez
 

library base62

base62 encode integer as a string and decode the string back to an integer

image

ajepe/base62

base62 encode integer as a string and decode the string back to an integer

  • Wednesday, July 18, 2018
  • by ajepe
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Build Status, (*1)

BASE62

Base is a small package that encodes integer to a string and decodes the same string back to an integer, this is can useful in making URL shortening application or generating unique URL slug. It convert the int id to base 62 characters with the encode method and converts it back to an integer with the decode public method., (*2)

  • It converts non-negative integer number like 42000000 up to PHP_INT_SIZE of the platform in which the package is being use on into a string like 2Qe7m. The action is reversible.
  • It can also decode the id back from 2Qe7m to 42000000.
  • This is useful in youtube like url or simply using them making url shortening website.

Install

Via Composer ``` bash composer require ajepe/base62:0.0.2, (*3)


### Usage ``` php require 'vendor/autoload.php'; $encode = new Base\Encode(); $decode = new Base\Decode(); $encode = $encode->encode(PHP_INT_MAX); //return HXy0p9 $decode = $decode->decode($encode); // return 24815682095 printf('The encode value of %s map directly to %s', $encode, $decode);

README.md, CHANGELOG.md, CONTRIBUTING.md, LICENSE.txt and composer.json, (*4)

Change log

Please see CHANGELOG for more information what has changed recently., (*5)

The Versions

18/07 2018

dev-master

9999999-dev

base62 encode integer as a string and decode the string back to an integer

  Sources   Download

MIT

The Development Requires

by Ajepe Babatope De Immaculate