PHPackages                             princejohnsantillan/id-base-converter - 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. princejohnsantillan/id-base-converter

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

princejohnsantillan/id-base-converter
=====================================

Encode integer IDs using a preset or customized symbol set

v1.0.5(2y ago)213.4k↓21.4%MITPHPPHP ^8.0

Since Dec 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/princejohnsantillan/id-base-converter)[ Packagist](https://packagist.org/packages/princejohnsantillan/id-base-converter)[ RSS](/packages/princejohnsantillan-id-base-converter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (3)Versions (8)Used By (0)

ID Base Converter
=================

[](#id-base-converter)

This package makes converting integer IDs into encoded strings and vice versa easy. You can use a preset symbol set, or you can define your own.

This can be useful if you want to add a layer of obfuscation to your integer IDs by encoding them into strings, which you can then decode back to the original ID.

For example, if you have a URL `https://example-dashboard.com/user/123` and you don't want to expose the exact database ID to the public, you can encode the ID. The URL could then become `https://example-dashboard.com/user/3F`.

Requirement
-----------

[](#requirement)

PHP 8.0 or higher

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

[](#installation)

```
composer require princejohnsantillan/id-base-converter
```

Usage
-----

[](#usage)

To use the available symbol sets:

```
use IdBaseConverter\IdBase;

// Symbols: '0123456789abcdef'
$converter = IdBase::asBase16();

// Symbols: '0123456789ABCDEF'
$converter = IdBase::asBase16uc();

// Symbols: '0123456789abcdefghijklmnopqrstuvwxyz'
$converter = IdBase::asBase36();

// Symbols: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
$converter = IdBase::asBase36uc();

// Symbols: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
$converter = IdBase::asAlphanumeric();
```

To use your own symbol set:

```
use IdBaseConverter\IdBase;

$converter = IdBase::symbols("0a1b2c3d4e5f6g7h8i9j");
```

Converting an integer ID:

```
use IdBaseConverter\IdBase;

IdBase::asBase16()->toString(123); // 7b

IdBase::asBase36uc()->toString(123); // 3F

IdBase::symbols("0a1b2c3d4e5f6g7h8i9j")->toString(123); // 3b
```

Converting an encoded string back to an integer ID:

```
use IdBaseConverter\IdBase;

IdBase::asBase16()->toInteger('7b'); // 123

IdBase::asBase16uc()->toInteger('3F'); // 123

IdBase::symbols("0a1b2c3d4e5f6g7h8i9j")->toInteger('3b'); // 123
```

Alternatively, you can use the `convert` method to convert an integer ID into an encoded string or vice versa:

```
use IdBaseConverter\IdBase;

IdBase::asAlphanumeric()->convert(12345); // 3d7

IdBase::asAlphanumeric()->convert('3d7'); // 12345
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

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

Recently: every ~25 days

Total

7

Last Release

767d ago

Major Versions

v0.1.0 → v1.0.02024-01-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/4eff78899d39d79e9eaf65df18ae55e18ff4be026524d311fdb178f9f2f1d0df?d=identicon)[princejohnsantillan](/maintainers/princejohnsantillan)

---

Top Contributors

[![princejohnsantillan](https://avatars.githubusercontent.com/u/60916966?v=4)](https://github.com/princejohnsantillan "princejohnsantillan (19 commits)")

---

Tags

hacktoberfestencodedecodebase converterid converterinteger to stringstring to integer

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/princejohnsantillan-id-base-converter/health.svg)

```
[![Health](https://phpackages.com/badges/princejohnsantillan-id-base-converter/health.svg)](https://phpackages.com/packages/princejohnsantillan-id-base-converter)
```

###  Alternatives

[hashids/hashids

Generate short, unique, non-sequential ids (like YouTube and Bitly) from numbers

5.4k48.6M278](/packages/hashids-hashids)[christian-riesen/base32

Base32 encoder/decoder according to RFC 4648

13331.8M61](/packages/christian-riesen-base32)[sqids/sqids

Generate short YouTube-looking IDs from numbers

5781.4M33](/packages/sqids-sqids)[torann/hashids

Laravel package for Hashids

54335.1k](/packages/torann-hashids)[skleeschulte/base32

Base32 encoding and decoding class (RFC 4648, RFC 4648 extended hex, Crockford, z-base-32/Zooko).

17314.5k9](/packages/skleeschulte-base32)[dflydev/base32-crockford

Encode/decode numbers using Douglas Crockford's Base32 Encoding

14379.1k1](/packages/dflydev-base32-crockford)

PHPackages © 2026

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