PHPackages                             obfuscateids/obfuscateids - 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. obfuscateids/obfuscateids

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

obfuscateids/obfuscateids
=========================

Generate the short,non-repeat,non-sequential string according the id number

1.0.1(6y ago)336[1 issues](https://github.com/allyfireshen/ObfuscateIds/issues)MITPHPPHP &gt;7.0

Since Apr 10Pushed 6y ago1 watchersCompare

[ Source](https://github.com/allyfireshen/ObfuscateIds)[ Packagist](https://packagist.org/packages/obfuscateids/obfuscateids)[ RSS](/packages/obfuscateids-obfuscateids/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)DependenciesVersions (3)Used By (0)

**ObfuscateIds** is a small php library to generate the short,non-repeat,non-sequential string from number. Use it when you don't want to expose your database numeric ids to users, or use it to generate the invitation code according to the users database numeric ids.

Getting Started
---------------

[](#getting-started)

Require the package with [Composer](https://getcomposer.org) in your project root directory.

```
$ composer require obfuscateids/obfuscateids
```

And then you can import the class into your application:

```
use ObfuscateIds\ObfuscateIds;

$obfuscateids = new ObfuscateIds();

$code = $obfuscateids -> encode(1);
echo $code;
```

Quick Example
-------------

[](#quick-example)

```
use ObfuscateIds\ObfuscateIds;

$obfuscateids = new ObfuscateIds();

$code = $obfuscateids -> encode(1); // 7D53D5

$nember = $obfuscateids -> decode($code); // 1
```

More Options
------------

[](#more-options)

**Using a custom alphabet and custom random string:**

```
use ObfuscateIds\ObfuscateIds;

$obfuscateids = new ObfuscateIds("C7YQTHLKRGW6F8AMNB42EVX", "5DPUJ3", 8);

$code = $obfuscateids -> encode(1); // 7JJ5PPDU

$nember = $obfuscateids -> decode($code); // 1
```

> **Note:** when the `$number` is less than custom alphabet length,the code non-unique and non-repeat; The custom alphabet and the custom random can't have the same characters and numbers.

Randomness
----------

[](#randomness)

The primary purpose of ObfuscateIds is to obfuscate numeric ids. It's **not** meant or tested to be used as a security or compression tool. Having said that, this algorithm does try to make these ids random and unpredictable.

License
-------

[](#license)

MIT License. See the [LICENSE](LICENSE) file. You can use ObfuscateIds in open source projects and commercial products.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Total

2

Last Release

2276d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.6.0

1.0.1PHP &gt;7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/24688380?v=4)[allyfireshen](/maintainers/allyfireshen)[@allyfireshen](https://github.com/allyfireshen)

---

Top Contributors

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

---

Tags

encodedecodeobfuscateids

### Embed Badge

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

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

###  Alternatives

[hashids/hashids

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

5.4k50.9M308](/packages/hashids-hashids)[sqids/sqids

Generate short YouTube-looking IDs from numbers

6771.8M46](/packages/sqids-sqids)[christian-riesen/base32

Base32 encoder/decoder according to RFC 4648

13333.2M71](/packages/christian-riesen-base32)[torann/hashids

Laravel package for Hashids

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

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

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

Encode/decode numbers using Douglas Crockford's Base32 Encoding

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

PHPackages © 2026

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