https://github.com/deemru/abcode
ABC (alphabet) encode/decode for PHP
https://github.com/deemru/abcode
base26 base36 base52 base58 base62 decode encode php
Last synced: 2 months ago
JSON representation
ABC (alphabet) encode/decode for PHP
- Host: GitHub
- URL: https://github.com/deemru/abcode
- Owner: deemru
- License: mit
- Created: 2019-01-12T21:20:25.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-04-10T15:29:35.000Z (about 2 years ago)
- Last Synced: 2025-03-10T01:28:25.013Z (3 months ago)
- Topics: base26, base36, base52, base58, base62, decode, encode, php
- Language: PHP
- Homepage: https://packagist.org/packages/deemru/abcode
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ABCode
[](https://packagist.org/packages/deemru/abcode) [](https://packagist.org/packages/deemru/abcode) [](https://github.com/deemru/ABCode/actions/workflows/php.yml) [](https://app.codacy.com/gh/deemru/ABCode/files) [](https://packagist.org/packages/deemru/abcode)
[ABCode](https://github.com/deemru/ABCode) is a universal (single byte per character) alphabet converter for PHP.
- Built in base58
- Convert strings to your alphabet
- Convert between alphabets## Usage
```php
// Built in base58
$data = ABCode::base58()->encode( 'Hello, world!' );
if( $data !== '72k1xXWG59wUsYv7h2' )
exit( 1 );// Convert strings to your alphabet
$abcode = new ABCode( 'my_ABC' );
$data = $abcode->encode( $data );
if( $data !== 'BAAy_Cmm_BA_AC_BCA_A_ymymCCmyyBBABBACCyBm___mA_BAm_yA__' )
exit( 1 );// Convert between alphabets
$abcode = new ABCode( 'my_ABC', 'another_ABC-123' );
$data = $abcode->decode( $data );
if( $data !== 'otah2_en3_o22ABhhrroA1eCAC3ronBn3t2-o' )
exit( 1 );
```## Requirements
- [PHP](http://php.net) >=5.4
- [GMP](http://php.net/manual/en/book.gmp.php)## Installation
Require through Composer:
```json
{
"require": {
"deemru/abcode": "1.0.*"
}
}
```