PHPackages                             stephenhill/base58 - 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. stephenhill/base58

ActiveLibrary

stephenhill/base58
==================

Base58 Encoding and Decoding Library for PHP

v2.1.0(6mo ago)841.8M—1.7%20[1 PRs](https://github.com/stephen-hill/base58php/pulls)20MITPHPPHP &gt;=8.1CI passing

Since Aug 30Pushed 6mo ago4 watchersCompare

[ Source](https://github.com/stephen-hill/base58php)[ Packagist](https://packagist.org/packages/stephenhill/base58)[ GitHub Sponsors](https://github.com/stephen-hill)[ RSS](/packages/stephenhill-base58/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (15)Used By (20)

Base58 Encoding and Decoding Library for PHP
============================================

[](#base58-encoding-and-decoding-library-for-php)

[![Packagist Release](https://camo.githubusercontent.com/9582d97f7a7992026363581525e5814d0549967e2f69e74a748dec21f058031f/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7374657068656e68696c6c2f6261736535382e737667)](https://packagist.org/packages/stephenhill/base58)[![MIT License](https://camo.githubusercontent.com/8a3593473e8b5bb2b1bd871bf00291851ba985af4d3b2be506ba3f00d360a5e9/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7374657068656e68696c6c2f6261736535382e737667)](https://github.com/stephen-hill/base58php/blob/master/license)[![Action Status](https://github.com/stephen-hill/base58php/actions/workflows/php.yml/badge.svg)](https://github.com/stephen-hill/base58php/actions/workflows/php.yml)

Long Term Support
-----------------

[](#long-term-support)

Each major version of this library will be supported for 5 years after it's initial release. Support will be provided for security and bug fixes.

- Version 2 will be supported until the 1st Janurary 2031.
- Version 1 support expired on the 11th September 2019.

Background
----------

[](#background)

I wanted a replacement for Base64 encoded strings and the [Base58 encoding used by Bitcoin](https://en.bitcoin.it/wiki/Base58Check_encoding) looked ideal. I looked around for an existing PHP library which would directly convert a string into Base58 but I couldn't find one, or at least one that worked correctly and was also well tested.

So I decided to create a library with the following goals:

- Encode/Decode PHP Strings
- Simple and easy to use
- Fully Tested
- Available via Composer

Requirements
------------

[](#requirements)

This library has the following requirements:

- PHP =&gt; 8.1
- GMP or BC Math Extension

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

[](#installation)

I recommend you install this library via Composer.

```
{
    "require": {
        "stephenhill/base58": "~2.0"
    }
}
```

Basic Usage
-----------

[](#basic-usage)

```
require_once('vendor/autoload.php');

$base58 = new StephenHill\Base58();

$base58->encode('Hello World');
$base58->decode('JxF12TrwUP45BMd');
```

Advanced Usage
--------------

[](#advanced-usage)

By default this library chooses the encoding service provider to use, either GMPService or BCMathService (in that order). If you want to specify one of the included services or your own, you can inject it into the constructor.

```
require_once('vendor/autoload.php');

$gmp = new StephenHill\GMPService();
$base58 = new StephenHill\Base58(null, $gmp);

$base58->encode('Hello World');
$base58->decode('JxF12TrwUP45BMd');
```

Also by default, this library uses Bitcoin's Base58 alphabet. If you want to use another variant, you can do this in the constructor.

```
require_once('vendor/autoload.php');

// Flickr's Base58 Alphabet
$base58 = new StephenHill\Base58('123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ');

$base58->encode('Hello World');
$base58->decode('iXf12sRWto45bmC');
```

Testing
-------

[](#testing)

This library is tested using PHPUnit.

```
$ bin/phpunit
```

Contributing
------------

[](#contributing)

I welcome everyone to contribute to this library. Please see the Contributing document for details.

License
-------

[](#license)

This library is license under the MIT License (MIT). Please see License File for more information.

Credits
-------

[](#credits)

This library was forked from [Jeremy Johnstone's](https://github.com/jsjohnst) Base58 methods on Gist .

Some of the unit tests were based on the following:

-
-

In no particular order, I would like to thank the following for pushing me to release a PHP 8 compatible version: @git-marijus, @VandalorumRex, @bacheson, @kalifg

###  Health Score

63

—

FairBetter than 99% of packages

Maintenance69

Regular maintenance activity

Popularity55

Moderate usage in the ecosystem

Community34

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 96.2% 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 ~409 days

Recently: every ~946 days

Total

11

Last Release

180d ago

Major Versions

v1.1.5 → v2.0.02025-11-11

### Community

Maintainers

![](https://www.gravatar.com/avatar/f73e12908980c0d70e9321234a7c8ebc13430de1ef4662476ea20c00d1a6d97b?d=identicon)[stephen-hill](/maintainers/stephen-hill)

---

Top Contributors

[![stephen-hill](https://avatars.githubusercontent.com/u/205619?v=4)](https://github.com/stephen-hill "stephen-hill (128 commits)")[![jsjohnst](https://avatars.githubusercontent.com/u/5507?v=4)](https://github.com/jsjohnst "jsjohnst (2 commits)")[![Fil](https://avatars.githubusercontent.com/u/7001?v=4)](https://github.com/Fil "Fil (1 commits)")[![jonaswebdev](https://avatars.githubusercontent.com/u/1163141?v=4)](https://github.com/jonaswebdev "jonaswebdev (1 commits)")[![orthographic-pedant](https://avatars.githubusercontent.com/u/14522744?v=4)](https://github.com/orthographic-pedant "orthographic-pedant (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/stephenhill-base58/health.svg)

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

PHPackages © 2026

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