PHPackages                             tonybogdanov/alphabase - 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. tonybogdanov/alphabase

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

tonybogdanov/alphabase
======================

Base-Anything conversions for PHP

v1.0.1(4y ago)0583MITPHP

Since Dec 10Pushed 4y ago1 watchersCompare

[ Source](https://github.com/TonyBogdanov/alphabase)[ Packagist](https://packagist.org/packages/tonybogdanov/alphabase)[ RSS](/packages/tonybogdanov-alphabase/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

Base-Anything conversions for PHP
=================================

[](#base-anything-conversions-for-php)

[![Latest Stable Version](https://camo.githubusercontent.com/da10d2c7e0096b6eb903512866d131b188128752a8139339c779c1fbd50f3e78/68747470733a2f2f706f7365722e707567782e6f72672f746f6e79626f6764616e6f762f616c706861626173652f762f737461626c65)](https://packagist.org/packages/tonybogdanov/alphabase)[![License](https://camo.githubusercontent.com/a5ccbb937b9e42319138f20a51d88cc5b170651d724803ce427a7092a49832eb/68747470733a2f2f706f7365722e707567782e6f72672f746f6e79626f6764616e6f762f616c706861626173652f6c6963656e7365)](https://packagist.org/packages/tonybogdanov/alphabase)[![Build](https://github.com/tonybogdanov/alphabase/workflows/build/badge.svg)](https://github.com/tonybogdanov/alphabase/workflows/build/badge.svg)[![Coverage](https://camo.githubusercontent.com/ced309036cb941a96b07e6511cbe27eb7687062e093085c372f9ea4949ea0d89/687474703a2f2f746f6e79626f6764616e6f762e6769746875622e696f2f616c706861626173652f636f7665726167652e737667)](http://tonybogdanov.github.io/alphabase/index.html)

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

[](#installation)

```
composer require tonybogdanov/alphabase:^1.0
```

Usage
-----

[](#usage)

Pass the string you want to convert as first argument, the alphabet (a string of unique characters) of the input as second argument, and the alphabet of the output as third argument.

The conversion expects all input characters to be found within the input alphabet and will convert them into characters found within the output alphabet.

If your input alphabet contains 32 characters and your output one contains 64, you are essentially converting from base32 into base64.

Keep in mind that the conversions here have nothing to do with standard algorithms like `base64`, and so are not interchangeable.

```
// qett
echo \TonyBogdanov\Alphabase\Converter::convert( 'abacab', 'abc', 'qwerty' );

// abacab
echo \TonyBogdanov\Alphabase\Converter::convert( 'qett', 'qwerty', 'abc' );
```

Caveat
------

[](#caveat)

It is not possible to unambiguously convert between bases without considering a special / padding character. Doing so, however, will force you to use a set of characters as your input alphabet + an extra padding character outside the alphabet, which will then make it impossible to convert from base256, since there will be no ASCII character available to use as padding.

To fix this issue the package will assume the very first character of each alphabet as the padding character. When a padding character is found at the beginning of your input string, it will be directly translated into the padding character of your output alphabet 1:1 without any conversion. This is only valid for the beginning of your input up until the very first occurrence of any other character. After that point the padding character will be converted like the rest.

This effect means you will lose the compressive capabilities of conversions like base32 to base128 for example, so keep that in mind.

A good consideration in regard to this is to always pick your alphabets such that the very first (padding) character is always one that has the lowest chance of being found in input strings, or at least in their beginning.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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 ~0 days

Total

2

Last Release

1614d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d19fd78c717e55b5e5cd750fa075b3c776c27f39c9f7c7414c4666d4b87f929d?d=identicon)[TonyBogdanov](/maintainers/TonyBogdanov)

---

Top Contributors

[![TonyBogdanov](https://avatars.githubusercontent.com/u/3586948?v=4)](https://github.com/TonyBogdanov "TonyBogdanov (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tonybogdanov-alphabase/health.svg)

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

###  Alternatives

[pocketmine/pocketmine-mp

A server software for Minecraft: Bedrock Edition written in PHP

3.5k74.6k86](/packages/pocketmine-pocketmine-mp)[godruoyi/php-snowflake

An ID Generator for PHP based on Snowflake Algorithm (Twitter announced).

8582.3M61](/packages/godruoyi-php-snowflake)[bitwasp/bitcoin

PHP Bitcoin library with functions for transactions, signatures, serialization, Random/Deterministic ECDSA keys, blocks, RPC bindings

1.1k533.2k43](/packages/bitwasp-bitcoin)[bitwasp/buffertools

Toolbox for working with binary and hex data. Similar to NodeJS Buffer.

65764.4k41](/packages/bitwasp-buffertools)[pocketmine/math

PHP library containing math related code used in PocketMine-MP

45573.2k14](/packages/pocketmine-math)[pocketmine/nbt

PHP library for working with Named Binary Tags

42574.4k13](/packages/pocketmine-nbt)

PHPackages © 2026

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