PHPackages                             northlands/permuteseq - 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. northlands/permuteseq

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

northlands/permuteseq
=====================

A small PHP library to obfuscate numbers.

v0.2(3y ago)01641MITPHPPHP ^8.1|^8.0

Since Sep 5Pushed 3y ago1 watchersCompare

[ Source](https://github.com/northlands-io/permuteseq)[ Packagist](https://packagist.org/packages/northlands/permuteseq)[ Docs](https://github.com/northlands/permuteseq)[ RSS](/packages/northlands-permuteseq/feed)WikiDiscussions main Synced today

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

A small PHP library to obfuscate numbers. Use it when you don't want to expose your database numeric ids to users.

The permutations are collision-free and fully deterministic. The random-looking effect is due to encryption, not to a PRNG. The same boundary range with the same secret key will always produce the same output.

[![Latest Version on Packagist](https://camo.githubusercontent.com/cf4ca2295ed522ee9d94e06094cfa703de401dd6fd807ed9b67e705550e20d11/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f7274686c616e64732f7065726d7574657365712e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/northlands/permuteseq)[![GitHub Tests Action Status](https://camo.githubusercontent.com/959c663682f7705fc870963dba54e1b0842bb9bfa3e2d7099535f6a8f9043cb7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6e6f7274686c616e64732d696f2f7065726d7574657365712f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/northlands-io/permuteseq/actions?query=workflow%3Arun-tests+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/95ce5c06c8da684062175291631d77475b343e376433214da87456091a2fdf88/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6f7274686c616e64732f7065726d7574657365712e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/northlands/permuteseq)

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

[](#installation)

You can install the package via composer:

```
composer require northlands/permuteseq
```

Usage
-----

[](#usage)

```
$permuteseq = new Permuteseq(123456789012345, 1000, 9999); // Range 1000-9999

$encoded = $permuteseq->encode(1000); // 1446
$decoded = $permuteseq->decode($encoded); // 1000
```

Testing
-------

[](#testing)

```
composer test
```

In order to ensure compability with the Postgres extension, an integration test is included:

```
vendor/bin/pest --group=integration
```

The integration test requires a running Postgres database with the extension installed:

```
docker build -t postgres tests
docker run --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=local -d postgres

psql> CREATE EXTENSION permuteseq;
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Disclaimer
----------

[](#disclaimer)

The library should not be considered cryptographically strong or used to sensitive data.

Credits
-------

[](#credits)

-
    The PostgreSQL extension by Daniel Vérité.
-
    An article on how to obfuscate primary keys in databases.

Alternatives
------------

[](#alternatives)

-
    Another Format Preserving Encryption library supporting multiple ciphers (DES, AES and Camellia) but slower performance.
-
    Generates YouTube-like ids from numbers. Can be limited to digit-alphabet, but returns strings like `"09284"` instead of safe integers.
-
    Super-fast number obfuscation based on Knuth's integer hash. However, range can only be defined by 4-62 bits.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

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

Total

2

Last Release

1396d ago

PHP version history (2 changes)v0.1PHP ^8.1

v0.2PHP ^8.1|^8.0

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

permutationobfuscationfiestel

###  Code Quality

TestsPest

### Embed Badge

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

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

###  Alternatives

[jenssegers/optimus

Id obfuscation based on Knuth's integer hash method

1.3k5.0M34](/packages/jenssegers-optimus)[alphazygma/combinatorics

Math libraries for Combinatorics (Combinations, Permutations, ...).

15200.6k](/packages/alphazygma-combinatorics)[delight-im/ids

Short, obfuscated and efficient IDs for PHP

2810.1k1](/packages/delight-im-ids)

PHPackages © 2026

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