2017 © Pedro Peláez
 

library basen

Text and integers encoding utilities for PHP with no extensions dependencies. Base32, Base58, Base64 and much more!

image

xobotyi/basen

Text and integers encoding utilities for PHP with no extensions dependencies. Base32, Base58, Base64 and much more!

  • Thursday, July 5, 2018
  • by xobotyi
  • Repository
  • 1 Watchers
  • 2 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

BaseN

License PHP 7 ready Build Status Codacy Grade Codacy Coverage Latest Stable Version Total Downloads , (*1)

About

PHP is a great language but unfortunately provides us with only one text encoding (base64) which even not URL safe. And there are no straight way to change its alphabet.
BaseN solves that problem and implements common binary-to-text algorithm for encodings whose alphabet fully covers number of bits that corresponds its length. And rough algorithm which will encode each byte separately, it is less compact but guarantee the encoding with given alphabet.
Furthermore it gives you methods to encode and decode integers themselves instead of their text representation., (*2)

Requirements

Installation

Install with composer, (*3)

composer require xobotyi/basen

Usage

use xobotyi\basen\BaseN;
use xobotyi\basen\Base58;

// use it for something usual
$base8 = new BaseN('01234567', false, false, false);
echo $base8->encode(16) . "\n"; // 142330
echo $base8->encodeInt(16) . "\n"; // 20

// or create your own encoder with own alphabet if needed
$myOwnEncoder = new BaseN('a123d8e4fiwnmqkl', false, true, true);
echo $myOwnEncoder->encode(16) . "\n"; // 313e
echo $myOwnEncoder->encodeInt(16) . "\n"; // 1a

// predefined encoder
echo Base58::encode(16) . "\n"; // 3hC
// or, with alternative alphabet
echo Base58::encode(16, Base58::ALPHABET_RIPPLE) . "\n"; // hkD
echo Base58::encodeInt(16) . "\n"; // G

Builtin encodings

BaseN provides few classes implementing most popular encodings: - Base16 (0-9a-f) - Base32 (a-z2-7) - Base36 (0-9a-z) - Base58 (0-9A-Za-v) - Base62 (0-9A-Za-z) - Base64 (0-9A-Za-z+/) - Base85 (!"#$%&'()*+,-./0-9:;=?@A-Z[]^_`a-u), (*4)

The Versions

05/07 2018

dev-master

9999999-dev https://github.com/xobotyi/basen

Text and integers encoding utilities for PHP with no extensions dependencies. Base32, Base58, Base64 and much more!

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Anton Zinovyev

text base32 rfc4648 binary encoding base64 base62 base16 base36 base58

29/06 2018

v1.0.0

1.0.0.0 https://github.com/xobotyi/basen

Text and integers encoding utilities for PHP with no extensions dependencies. Base32, Base58, Base64 and much more!

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Anton Zinovyev

text base32 rfc4648 binary encoding base64 base62 base16 base36 base58