PHP Classes
elePHPant
Icontem

PHP Base Converter: Convert number representations between two bases

Recommend this page to a friend!
  Info   View files Documentation   View files View files (35)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2018-09-01 (1 month ago) RSS 2.0 feedNot yet rated by the usersTotal: 34 This week: 3All time: 9,356 This week: 134Up
Version License PHP version Categories
baseconverter 1.0MIT/X Consortium ...5PHP 5, Text processing, Conversion
Description Author

This package can convert number representations between two bases.

It can take a string with a value represented in a given base and can convert the number to another base.

The class returns a new string with the number represented in the new base.

It supports different bases like base 64, base 32, and base 16.

Name: FN <contact>
Classes: 2 packages by
Country: ???
Age: 48
All time rank: 4230
Week rank: 137 Up

Details

BaseConverter

Build Status GitHub version Code Coverage

Description

BaseConverter is a simple and small library to convert interger values to different other bases and back.

Install via composer

Just run the following command in your project root:

composer require neoblack/base-converter:~1.0

Example usage

<?php
require_once 'vendor/autoload.php';
use NeoBlack\BaseConverter\BaseConverter;

$number = 100;

$base64Number = BaseConverter::toBase($number, BaseConverter::BASE64); // Result: 1A
$base62Number = BaseConverter::toBase($number, BaseConverter::BASE62); // Result: 1C
$base32Number = BaseConverter::toBase($number, BaseConverter::BASE32); // Result: 34
$base16Number = BaseConverter::toBase($number, BaseConverter::BASE16); // Result: 64

BaseConverter::to10Base($base64Number, BaseConverter::BASE64); // Result: 100
BaseConverter::to10Base($base62Number, BaseConverter::BASE62); // Result: 100
BaseConverter::to10Base($base32Number, BaseConverter::BASE32); // Result: 100
BaseConverter::to10Base($base16Number, BaseConverter::BASE16); // Result: 100

Developer Notes

If you want to contribute, fork this repository and send a pull request.

Unit Test

./bin/phpunit -c Build/UnitTests.xml

Coverage report

rm -rf docs
./bin/phpunit -c Build/UnitTests.xml --coverage-html docs

License

The MIT License (MIT) see license file.

  Files folder image Files  
File Role Description
Files folder image.github (2 files)
Files folder imageBuild (2 files)
Files folder imagedocs (3 files, 5 directories)
Files folder imagesrc (2 directories)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  .github  
File Role Description
  Accessible without login Plain text file ISSUE_TEMPLATE.md Data Auxiliary data
  Accessible without login Plain text file PULL_REQUEST_TEMPLATE.md Data Auxiliary data

  Files folder image Files  /  Build  
File Role Description
  Accessible without login Plain text file UnitTests.xml Data Auxiliary data
  Accessible without login Plain text file UnitTestsBootstrap.php Class Class source

  Files folder image Files  /  docs  
File Role Description
Files folder imageClasses (3 files)
Files folder imagecss (3 files)
Files folder imagefonts (1 file)
Files folder imagejs (7 files)
Files folder imageTests (2 files, 1 directory)
  Accessible without login HTML file BaseConverter.php.html Doc. Documentation
  Accessible without login HTML file dashboard.html Doc. Documentation
  Accessible without login HTML file index.html Doc. Documentation

  Files folder image Files  /  docs  /  Classes  
File Role Description
  Accessible without login HTML file BaseConverter.php.html Doc. Documentation
  Accessible without login HTML file dashboard.html Doc. Documentation
  Accessible without login HTML file index.html Doc. Documentation

  Files folder image Files  /  docs  /  css  
File Role Description
  Accessible without login Plain text file bootstrap.min.css Data Auxiliary data
  Accessible without login Plain text file nv.d3.min.css Data Auxiliary data
  Accessible without login Plain text file style.css Data Auxiliary data

  Files folder image Files  /  docs  /  fonts  
File Role Description
  Accessible without login Plain text file glyphicons-halflings-regular.svg Data Auxiliary data

  Files folder image Files  /  docs  /  js  
File Role Description
  Accessible without login Plain text file bootstrap.min.js Data Auxiliary data
  Accessible without login Plain text file d3.min.js Data Auxiliary data
  Accessible without login Plain text file holder.min.js Data Auxiliary data
  Accessible without login Plain text file html5shiv.min.js Data Auxiliary data
  Accessible without login Plain text file jquery.min.js Data Auxiliary data
  Accessible without login Plain text file nv.d3.min.js Data Auxiliary data
  Accessible without login Plain text file respond.min.js Data Auxiliary data

  Files folder image Files  /  docs  /  Tests  
File Role Description
Files folder imageUnit (4 files)
  Accessible without login HTML file dashboard.html Doc. Documentation
  Accessible without login HTML file index.html Doc. Documentation

  Files folder image Files  /  docs  /  Tests  /  Unit  
File Role Description
  Accessible without login HTML file BaseConverterTest.php.html Doc. Documentation
  Accessible without login HTML file BaseTestCase.php.html Doc. Documentation
  Accessible without login HTML file dashboard.html Doc. Documentation
  Accessible without login HTML file index.html Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imageClasses (1 file)
Files folder imageTests (1 directory)

  Files folder image Files  /  src  /  Classes  
File Role Description
  Accessible without login Plain text file BaseConverter.php Class Class source

  Files folder image Files  /  src  /  Tests  
File Role Description
Files folder imageUnit (2 files)

  Files folder image Files  /  src  /  Tests  /  Unit  
File Role Description
  Accessible without login Plain text file BaseConverterTest.php Class Class source
  Accessible without login Plain text file BaseTestCase.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:34
This week:3
All time:9,356
This week:134Up