PHPackages                             koksosk/base32hex - 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. koksosk/base32hex

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

koksosk/base32hex
=================

Base32Hex encoder/decoder

182.3k↓36.8%[1 issues](https://github.com/koksosk/base32hex/issues)PHP

Since Dec 3Pushed 11y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

About
=====

[](#about)

Base32Hex is simple and easy to use class for `base32hex` encoding/decoding. Learn more about `base32hex` in this [wiki section](http://en.wikipedia.org/wiki/Base32#base32hex) or in [RFC 2938](http://tools.ietf.org/rfc/rfc2938) standard document.

Base32Hex library
=================

[](#base32hex-library)

[![Build Status](https://camo.githubusercontent.com/27551463b80bc9e3fe351d7eae1a796a81f85bd6415b314cf3cc9cf628b16b64/68747470733a2f2f7472617669732d63692e6f72672f6b6f6b736f736b2f6261736533326865782e737667)](https://travis-ci.org/koksosk/base32hex)[![Latest Stable Version](https://camo.githubusercontent.com/7a329ed57afa6e44de47890aab8d96c9dc78ee5821ce4ee2e366f0b347e4a18e/68747470733a2f2f706f7365722e707567782e6f72672f6b6f6b736f736b2f6261736533326865782f762f737461626c652e737667)](https://packagist.org/packages/koksosk/base32hex)[![Total Downloads](https://camo.githubusercontent.com/9f4025db639b45065776a08abcd6893f43f8edd61a6074577019da7c16e6944d/68747470733a2f2f706f7365722e707567782e6f72672f6b6f6b736f736b2f6261736533326865782f646f776e6c6f6164732e737667)](https://packagist.org/packages/koksosk/base32hex)[![Latest Unstable Version](https://camo.githubusercontent.com/14cea615ffd04e87e620ad244cbb57f9028ec08980ed4bbd3d654ddd16061b95/68747470733a2f2f706f7365722e707567782e6f72672f6b6f6b736f736b2f6261736533326865782f762f756e737461626c652e737667)](https://packagist.org/packages/koksosk/base32hex)[![License](https://camo.githubusercontent.com/ad20f0bf8e46c71bb27b56ad2af8b4aeb8db783a3198e0d8960e84656e45ff20/68747470733a2f2f706f7365722e707567782e6f72672f6b6f6b736f736b2f6261736533326865782f6c6963656e73652e737667)](https://packagist.org/packages/koksosk/base32hex)

Base32Hex class implements `base32hex` algorithm (as stated in [RFC 2938](http://tools.ietf.org/rfc/rfc2938)) and implements these two main static methods:

- [Koksosk\\Base32Hex::encode($string)](#encode)
- [Koksosk\\Base32Hex::decode($string)](#decode)

Also these helper functions are included:

- [Koksosk\\Base32Hex::stringToBinary($string)](#string-to-binary)
- [Koksosk\\Base32Hex::binaryToString($string)](#binary-to-string)

See [usage](#usage-examples) section below to see examples of usage. See the `docs/` folder for generated API documentation.

Important
---------

[](#important)

Please don't **CONFUSE** [base32hex](http://tools.ietf.org/rfc/rfc2938) with [base32](https://tools.ietf.org/html/rfc4648) encoding, which looks is similar but it is different standard.

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

[](#requirements)

**Koksosk\\Base32Hex** requires `PHP 5.3+`, that's all.

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

[](#installation)

The preferred method of installation is via [Packagist](http://packagist.org/), as this provides the `PSR-0` autoloader functionality. The following `composer.json` will download and install the latest version of the **Koksosk\\Base32Hex** library into your project:

```
{
    "require": {
        "koksosk/base32hex": "*"
    }
}
```

Usage examples
--------------

[](#usage-examples)

#### Encode

[](#encode)

Encoding string to base32hex.

```
// Encoding string 'Hello' to base32hex string
$s = \Koksosk\Base32Hex::encode('Hello');

var_dump($s);
```

This produces the following output:

```
string(8) "91IMOR3F"

```

#### Decode

[](#decode)

Decoding string from base32hex string.

```
// Decoding string from base32hex string '91IMOR3F'
$s = \Koksosk\Base32Hex::decode('91IMOR3F');

var_dump($s);
```

This produces the following output:

```
string(5) "Hello"

```

#### String to binary

[](#string-to-binary)

Convert string to binary string

```
// Converting string "Hello" to binary string
$s = \Koksosk\Base32Hex::stringToBinary("Hello");

var_dump($s);
```

This produces the following output (length = 40bits = strlen("Hello") \* 8 bits = 5 \* 8 bits):

```
string(40) "0100100001100101011011000110110001101111"

```

#### Binary to string

[](#binary-to-string)

Convert binary string to string

```
// Converting binary string "0100100001100101011011000110110001101111" to string
$s = \Koksosk\Base32Hex::binaryToString("0100100001100101011011000110110001101111");

var_dump($s);
```

This produces the following output:

```
string(40) "Hello"

```

License
-------

[](#license)

Copyright © 2014 Tomas Chvostek.

Licensed under the MIT License [see here](LICENSE).

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

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

---

Top Contributors

[![koksosk](https://avatars.githubusercontent.com/u/9059130?v=4)](https://github.com/koksosk "koksosk (13 commits)")

### Embed Badge

![Health badge](/badges/koksosk-base32hex/health.svg)

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

###  Alternatives

[schmeits/filament-4-phosphor-icons

This is my package filament-4-phosphor-icons

172.7k](/packages/schmeits-filament-4-phosphor-icons)

PHPackages © 2026

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