2017 © Pedro Peláez
 

library tiny

A reversible base62 ID obfuscater.

image

zackkitzmiller/tiny

A reversible base62 ID obfuscater.

  • Tuesday, February 7, 2017
  • by zackkitzmiller
  • Repository
  • 24 Watchers
  • 398 Stars
  • 72,348 Installations
  • PHP
  • 2 Dependents
  • 1 Suggesters
  • 29 Forks
  • 3 Open issues
  • 8 Versions
  • 6 % Grown

The README.md

Build Status Coverage Status, (*1)

Tiny

A reversible base62 ID obfuscater, (*2)

Authors

Originally by Jacob DeHart, with Ruby and Python ports by Kyle Bragger, (*3)

Now maintained by Zack Kitzmiller., (*4)

Installation

Install via Composer, (*5)

{
    "require": {
        "zackkitzmiller/tiny": "1.2.0"
    },
}

Usage

$tiny = new \ZackKitzmiller\Tiny('5SX0TEjkR1mLOw8Gvq2VyJxIFhgCAYidrclDWaM3so9bfzZpuUenKtP74QNH6B');

echo $tiny->to(5);
// E

echo $tiny->from('E');
// 5

echo $tiny->to(126);
// XX

echo $tiny->from('XX');
// 126

echo $tiny->to(999);
// vk

echo $tiny->from('vk');
// 999

Configuration

You must instanciate a new instance of Tiny with a random alpha-numeric set where each character must only be used exactly once. Do NOT change this once you start using Tiny, as you won't be able to reverse., (*6)

You can generate a random set from the commandline with $ ./bin/genset, (*7)

Using laravel?

If you're using laravel and want to use a more laravel-like and cleaner syntax you only have to follow these steps., (*8)

First open your app/config/app.php file and scroll down to your providers and add, (*9)

'providers' => array(
    ...
    'ZackKitzmiller\TinyServiceProvider',
)

and then this to aliases, (*10)

'aliases' => array(
    ...
    'Tiny' => 'ZackKitzmiller\Facades\Tiny',
)

Lastly you run php artisan config:publish zackkitzmiller/tiny to publish the configuration file and then run php artisan tiny:generate to create a valid key., (*11)

Usage in Laravel

echo Tiny::to(999);
// echos vk

echo Tiny::from('E');
// echos 5

The Versions

07/02 2017

dev-master

9999999-dev

A reversible base62 ID obfuscater.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Zack Kitzmiller
by Jacob DeHart
by Kyle Bragger

07/02 2017

1.3.0

1.3.0.0

A reversible base62 ID obfuscater.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Zack Kitzmiller
by Jacob DeHart
by Kyle Bragger

21/06 2014

1.2.1

1.2.1.0 http://github.com/zackkitzmiller/tiny-php

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Zack Kitzmiller
by Jacob DeHart
by Kyle Bragger

21/06 2014

1.2.0

1.2.0.0 http://github.com/zackkitzmiller/tiny-php

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Zack Kitzmiller
by Jacob DeHart
by Kyle Bragger

20/01 2014

1.1.0

1.1.0.0 http://github.com/zackkitzmiller/tiny-php

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Zack Kitzmiller
by Jacob DeHart
by Kyle Bragger

17/01 2014

1.0.2

1.0.2.0 http://github.com/zackkitzmiller/tiny-php

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Zack Kitzmiller
by Jacob DeHart
by Kyle Bragger

30/11 2013

1.0.1

1.0.1.0 http://github.com/zackkitzmiller/tiny-php

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Zack Kitzmiller
by Jacob DeHart
by Kyle Bragger

30/11 2013

1.0

1.0.0.0 http://github.com/zackkitzmiller/tiny-php

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Zack Kitzmiller
by Jacob DeHart
by Kyle Bragger