PHPackages                             ierusalim/baseconvert - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ierusalim/baseconvert

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ierusalim/baseconvert
=====================

Convertation from/to any user-defined base-chars-string throught decimal representation of arbitrary precision

0.4.1(6y ago)037[1 issues](https://github.com/ierusalim/baseconvert/issues)Apache-2.0PHPPHP &gt;=5.3

Since Feb 17Pushed 6y ago1 watchersCompare

[ Source](https://github.com/ierusalim/baseconvert)[ Packagist](https://packagist.org/packages/ierusalim/baseconvert)[ RSS](/packages/ierusalim-baseconvert/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

BaseConvert
===========

[](#baseconvert)

[![Build Status](https://camo.githubusercontent.com/c55e1eacf6a098d377e7e983d649a1eb7d1e4335a9b1d3ffec15f0df859877cc/68747470733a2f2f6170692e7472617669732d63692e6f72672f6965727573616c696d2f62617365636f6e766572742e7376673f6272616e63683d6d6173746572)](https://www.travis-ci.org/ierusalim/baseconvert)

Convertation from/to any user-defined base-chars-string throught decimal representation of arbitrary precision.

Installation
------------

[](#installation)

File BaseConvert.php may be use independent.

For [composer](https://getcomposer.org/):

```
composer require ierusalim/baseconvert

```

Usage BaseConvert
-----------------

[](#usage-baseconvert)

Create instance of BaseConvert class and define own base-characters string (if need).

No need to define new alphabet for use hex/binary/base58(bitcoin compatible).

```
use ierusalim\BaseConvert;

$bc = new BaseConvert;

$hex = "43786437856abcdef";
$b58 = $bc->hextobase58($hex);

echo "$hex => base58: $b58";
```

Functions
---------

[](#functions)

- -&gt; dectohex($dec) -- Convert from decimal (012345679-base) to hex (0123456789abcdef-base)
- -&gt; hextodec($hex) -- Convert from hex (0123456789abcdef-base) to decimal (012345679-base)
- -&gt; dectobits($dec) -- Convert from decimal (012345679-base) to string of bits (01-base)
- -&gt; bitstodec($bits) -- Convert from bits to decimal representation of arbitrary precision
- -&gt; hextobits($hex) -- Convert from hex (0123456789abcdef-base) to bits string (01-base)
- -&gt; bitstohex($bits) -- Convert from bits (01-base) to hex (0123456789abcdef-base)
- -&gt; dectobase58($dec) -- Convert from decimal (012345679-base) to base58
- -&gt; hextobase58($hex) -- Convert from hex (0123456789abcdef-base) to base58
- -&gt; base58tohex($b58) -- Convert from base58 to hex (0123456789abcdef-base)
- -&gt; basex\_decode($data, $base\_id) -- Convert from arbitrary base to decimal
- -&gt; basex\_encode($dec, $base\_id) -- Convert from decimal to arbitrary base

Usage vc85
----------

[](#usage-vc85)

vc85 is a one of many base85-algorithms, like ascii85, z85, etc.

Encoding vc85 has the following features:

- Each character is visually unique and easily recognizable: 0123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyzзгджилпфцчшюяБГДЖИЛПФЦЧШЮЯ
- Encoded result does not contain special characters;
- encoding and decoding runs fast.

```
use ierusalim\BaseConvert;

$bc = new vc85();

$str = "One day I'm gonna fly away One day when heavens calls my name";
$enc = $bc->vc85_encode($str);

echo "result: $enc \n";

// result: RkШжцYNQлAPjhWЮZLжz9XJZEЯeФ3nVXTБЮДbgГЧ3XTБЯVZnЯ67ZnЮtЦYrЯpJXФШGБd0BUdAbЮu81G

$back = $bc->vc85_decode($enc);

echo ($str === $back) ? "OK" : "Fail";
```

Functions vc85
--------------

[](#functions-vc85)

- -&gt; vc85\_encode($str) -- Convert from binary data to vc85
- -&gt; vc85\_decode($str) -- Convert from vc85 to binary data

Functions base6400
------------------

[](#functions-base6400)

- -&gt; base6400\_encode($str) -- Convert from binary to base6400
- -&gt; base6400\_decode($str) -- Convert from base6400 to binary
- -&gt; explodeToUnicode($str) -- Convert string from utf-8 to Unicode-array
- -&gt; implodeUnicode($arr) -- Convert Unicode-array to utf-8 string

Bases (pre-defined base\_id)
----------------------------

[](#bases-pre-defined-base_id)

```
    public $bases = [
        2 => '01',
        3 => '012',
        4 => '0123',
        8 => '01234567',
        10 => '0123456789',
        16 => '0123456789abcdef',
        58 => '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz',
    ];
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~95 days

Recently: every ~6 days

Total

6

Last Release

2531d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8d8f053e8eb8f750c7b644613b51c876a71c931b8a1eb0f11e2b987c9275b01e?d=identicon)[ierusalim](/maintainers/ierusalim)

---

Top Contributors

[![ierusalim](https://avatars.githubusercontent.com/u/29404724?v=4)](https://github.com/ierusalim "ierusalim (38 commits)")

---

Tags

bitcoinbase58baseConvertdectohexhextodecdechexhexdecdectobindectobitsbitstodec

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ierusalim-baseconvert/health.svg)

```
[![Health](https://phpackages.com/badges/ierusalim-baseconvert/health.svg)](https://phpackages.com/packages/ierusalim-baseconvert)
```

###  Alternatives

[bitcoin-php/bitcoin-ecdsa

PHP library allowing to generate BTC addresses from private keys

23062.6k7](/packages/bitcoin-php-bitcoin-ecdsa)[tuupola/base58

Base58 encoder and decoder for arbitrary data

56609.6k22](/packages/tuupola-base58)[bitwasp/bitcoin-lib

Implementation of raw transactions in bitcoin, HD wallets, Electrum wallets, and other fun stuff.

13922.3k5](/packages/bitwasp-bitcoin-lib)[xobotyi/basen

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

1219.6k](/packages/xobotyi-basen)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
