PHPackages                             seb-c/alpha-increment - 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. seb-c/alpha-increment

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

seb-c/alpha-increment
=====================

A library to generate a really unique string from just a classic auto-incremental numeric id.

1.0.0(9y ago)135PHPPHP &gt;=5.6

Since Nov 19Pushed 9y agoCompare

[ Source](https://github.com/Seb-C/AlphaIncrement)[ Packagist](https://packagist.org/packages/seb-c/alpha-increment)[ RSS](/packages/seb-c-alpha-increment/feed)WikiDiscussions master Synced 3w ago

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

AlphaIncrement is a simple library that allows you to generate really unique strings from an incremental id.

This does not aim to be cryptographically secure nor to be used for security purposes.

This is useful if you need an easy way to get some kind of unique serial number without especially needing to hide the original id.

As you can see below, there is still some kind of pattern in the results that an end-user may guess, but it shouldn't be a problem in most cases.

Basic use
=========

[](#basic-use)

```
$ai = new AlphaIncrement();
echo $ai->encode(1); // prints "TKSAC"
echo $ai->encode(2); // prints "TKSAD"
echo $ai->encode(3); // prints "TKSAZ"
echo $ai->encode(42); // prints "TKSKY"
echo $ai->encode(314); // prints "TKSGB"
echo $ai->encode(7654321); // prints "9JXCC"
```

Advanced use
============

[](#advanced-use)

You can pass three arguments to the constructor :

- The length of the result string (default: 5);
- The alphabet (list of chars to use, as a string). Default: digits and uppercase letters. Unicode characters are supported;
- You can pass false here to disable the alphabet shuffling, which is used by default to improve randomization of the results.

```
$ai = new AlphaIncrement(4, '😀😃😉😋😎😴😕😓😞😇', false);
echo $ai->encode(1); // prints "😋😞😉😴"
echo $ai->encode(2); // prints "😋😞😉😕"
echo $ai->encode(3); // prints "😋😞😉😓"
echo $ai->encode(42); // prints "😋😞😉😞"
echo $ai->encode(314); // prints "😋😞😉😇"
echo $ai->encode(654321); // prints "😋😞😉😀"
```

Big numbers
===========

[](#big-numbers)

Of course you can't fit an infinite amount of ids in a size limited string. The way to fallback from an id too large to fit in the specified size is to make a string larger that the expected size

```
$ai = new AlphaIncrement(3);
echo $ai->encode(10); // returns "SAT"
echo $ai->encode(42); // returns "SKY"
echo $ai->encode(7654321); // returns "9JXCC"
echo $ai->encode(PHP_INT_MAX); // returns "1UL1RDNFPP5OW"
```

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3509d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2553075?v=4)[Sébastien Aoki (aka Caparros)](/maintainers/Seb-C)[@Seb-C](https://github.com/Seb-C)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/seb-c-alpha-increment/health.svg)

```
[![Health](https://phpackages.com/badges/seb-c-alpha-increment/health.svg)](https://phpackages.com/packages/seb-c-alpha-increment)
```

###  Alternatives

[spatie/nova-backup-tool

A Laravel Nova tool to backup your application.

362574.8k1](/packages/spatie-nova-backup-tool)

PHPackages © 2026

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