Download the PHP package tuupola/base62 without Composer
On this page you can find all versions of the php package tuupola/base62. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tuupola/base62
More information about tuupola/base62
Files in tuupola/base62
Package base62
Short Description Base62 encoder and decoder for arbitrary data
License MIT
Homepage https://github.com/tuupola/base62
Informations about the package base62
Base62
This library implements base62 encoding. In addition to integers it can encode and decode any arbitrary data. This is useful for example when generating url safe random tokens for database identifiers.
Install
Install with composer.
This branch requires PHP 7.1 or up. The older 1.x
branch supports also PHP 5.6 and 7.0.
Usage
This package has both pure PHP and GMP based encoders. By default encoder and decoder will use GMP functions if the extension is installed. If GMP is not available pure PHP encoder will be used instead.
If you are encoding to and from integer use the implicit decodeInteger()
and encodeInteger()
methods.
Note that encoding a string and an integer will yield different results.
Character sets
By default Base62 uses GMP style character set. Shortcut is provided for the inverted character set which is also commonly used. You can also use any custom character set of 62 unique characters.
Speed
Install GMP if you can. It is much faster pure PHP encoder. Below benchmarks are for encoding random_bytes(128)
data. BCMatch encoder is also included but it is mostly just a curiosity. It is too slow to be usable.
Static Proxy
If you prefer to use static syntax use the provided static proxy.
Testing
You can run tests either manually or automatically on every code change. Automatic tests require entr to work.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.