brianfreytag / php-bijective
Encodes any integer into a base(n) string
Installs: 89 367
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=5.3.3
Requires (Dev)
- phpunit/phpunit: >=3.7
This package is auto-updated.
Last update: 2024-12-09 08:27:24 UTC
README
Encodes any integer into a base(n) string using a defined alphabet.
Installation
The suggested installation method is via composer:
php composer.phar require brianfreytag/php-bijective:dev-master
Usage
After installing the Bijective library, simply create a new instance of the Bijective class, passing in a defined alphabet.
<?php use Bijective\BijectiveTranslator; $alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $bijective = new BijectiveTranslator($alphabet); $encoded = $bijective->encode(123); // Returns ct $decoded = $bijective->decode('ct'); // Returns 123