PHPackages                             webictbyleo/odoid - 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. webictbyleo/odoid

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

webictbyleo/odoid
=================

Deterministic mixed-radix ID encoding — maps integers to 6, 7, or 8-character alphanumeric strings. Ambiguous characters I, L, O excluded.

v1.0.2(1mo ago)00MITPHPPHP ^8.1

Since May 6Pushed 1mo agoCompare

[ Source](https://github.com/Webictbyleo/odoid-php)[ Packagist](https://packagist.org/packages/webictbyleo/odoid)[ Docs](https://github.com/Webictbyleo/odoid)[ RSS](/packages/webictbyleo-odoid/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

odoid
=====

[](#odoid)

Deterministic mixed-radix ID encoding. Maps a non-negative integer to a 6, 7, or 8-character alphanumeric string with a serial-number aesthetic.

```
use Webictbyleo\OdoID\OdoId;

OdoId::encode(0,            6);  // "0A0000"
OdoId::encode(1234567,      6);  // "0D7NM7"
OdoId::encode(1234567,      7);  // "0A15NM7"
OdoId::encode(236223201279, 8);  // "ZZ9ZZZZZ"
```

Features
--------

[](#features)

- **Deterministic** — same integer + length always produces the same string, and vice-versa.
- **Human-readable** — ambiguous characters `I`, `L`, `O` are excluded from all positions.
- **Fixed positional structure** — position 1 is always a letter, position 2 is always a digit.
- **Zero dependencies** — pure PHP standard library, PHP 8.1+.

Install
-------

[](#install)

```
composer require webictbyleo/odoid
```

Usage
-----

[](#usage)

### Encode

[](#encode)

```
use Webictbyleo\OdoID\OdoId;

OdoId::encode(0, 6);            // "0A0000"
OdoId::encode(1234567, 6);      // "0D7NM7"
OdoId::encode(1234567, 7);      // "0A15NM7"
OdoId::encode(236223201279, 8); // "ZZ9ZZZZZ"

// Default length is 6
OdoId::encode(0); // "0A0000"
```

### Decode

[](#decode)

```
OdoId::decode("0D7NM7");   // 1234567
OdoId::decode("0d7nm7");   // 1234567 (lowercase accepted)
```

### OdoIDGenerator

[](#odoidgenerator)

```
use Webictbyleo\OdoID\OdoIDGenerator;

$g = new OdoIDGenerator(namespace: 'orders', length: 7);
$result = $g->next();
// $result['id']        → e.g. "3H5NV2K"
// $result['n']         → the raw integer
// $result['length']    → 7
// $result['namespace'] → "orders"
```

Lengths and Capacity
--------------------

[](#lengths-and-capacity)

LengthMax integer (exclusive)6230,686,72077,381,975,0408236,223,201,280Exceptions
----------

[](#exceptions)

All extend `\InvalidArgumentException`:

ExceptionWhen`OdoOverflowException``$n >= MAX[$length]``UnsupportedLengthException`length is not 6, 7, or 8`InvalidCharacterException`character not in positional charset during decode```
use Webictbyleo\OdoID\OdoOverflowException;
use Webictbyleo\OdoID\UnsupportedLengthException;
use Webictbyleo\OdoID\InvalidCharacterException;

try {
    OdoId::decode("0A000O");
} catch (InvalidCharacterException $e) {
    echo $e->char;     // "O"
    echo $e->position; // 6
}
```

Run tests
---------

[](#run-tests)

```
composer install
vendor/bin/phpunit
```

Monorepo
--------

[](#monorepo)

This repository is the Packagist-facing split of the PHP package from the [Webictbyleo/odoid](https://github.com/Webictbyleo/odoid) monorepo, which contains implementations in TypeScript, Python, Go, C#, Rust, Lua, and Java.

Specification
-------------

[](#specification)

See [SPEC.md](https://github.com/Webictbyleo/odoid/blob/main/SPEC.md) for the full processing instruction document.

License
-------

[](#license)

MIT

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance93

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

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

3

Last Release

33d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/24a80d2f27c682d8fcf93aeb6df545154ea75e623b5ba936492148c358f88d63?d=identicon)[Leo anthony](/maintainers/Leo%20anthony)

---

Tags

encodingiddeterministicserial

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/webictbyleo-odoid/health.svg)

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

###  Alternatives

[paragonie/constant_time_encoding

Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)

904351.6M178](/packages/paragonie-constant-time-encoding)[paquettg/string-encode

Facilitating the process of altering string encoding in PHP.

699.0M43](/packages/paquettg-string-encode)[cybercog/laravel-optimus

An Optimus bridge for Laravel. Id obfuscation based on Knuth's multiplicative hashing method.

192573.4k](/packages/cybercog-laravel-optimus)[onnov/detect-encoding

Text encoding definition class instead of mb\_detect\_encoding. Defines: utf-8, windows-1251, koi8-r, iso-8859-5, ibm866, .....

224.0M15](/packages/onnov-detect-encoding)[pugx/shortid-php

An implementation of shortid in PHP

52606.9k3](/packages/pugx-shortid-php)[jawira/plantuml-encoding

PlantUML encoding functions

20605.9k11](/packages/jawira-plantuml-encoding)

PHPackages © 2026

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