deemru/abcode

ABC (alphabet) encode/decode

1.0.3 2020-04-06 21:19 UTC

This package is auto-updated.

Last update: 2021-07-07 00:24:02 UTC


README

packagist php-v travis codacy license

ABCode is a universal (single byte per character) alphabet converter for PHP.

  • Built in base58
  • Convert strings to your alphabet
  • Convert between alphabets

Usage

// 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

Installation

Require through Composer:

{
    "require": {
        "deemru/abcode": "1.0.*"
    }
}