PHPackages                             jelle-s/permutations - 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. jelle-s/permutations

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

jelle-s/permutations
====================

Generates (lexographical) permutations of numbers.

1.0.1(9y ago)02761GPL-3.0+PHP

Since Dec 13Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Jelle-S/permutations)[ Packagist](https://packagist.org/packages/jelle-s/permutations)[ RSS](/packages/jelle-s-permutations/feed)WikiDiscussions develop Synced 4w ago

READMEChangelog (2)DependenciesVersions (4)Used By (1)

Generates (lexographical) permutations.

[![Build Status](https://camo.githubusercontent.com/4c4e1ab862dd41bdcdbf6d916cbf1b024e779bd41747b211887d674bb76edf69/68747470733a2f2f7472617669732d63692e6f72672f4a656c6c652d532f7065726d75746174696f6e732e7376673f6272616e63683d646576656c6f70)](https://travis-ci.org/Jelle-S/permutations) [![Code Climate](https://camo.githubusercontent.com/3f8073fdbddc3971521a870c710d393efe4c61d8ad9ca5d9ff38be1a02bc8410/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f4a656c6c652d532f7065726d75746174696f6e732f6261646765732f6770612e737667)](https://codeclimate.com/github/Jelle-S/permutations) [![Test Coverage](https://camo.githubusercontent.com/21441a29827a596e8b9192d47b24878f6f93caf5174280fa6e48664a9104d8d5/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f4a656c6c652d532f7065726d75746174696f6e732f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/Jelle-S/permutations/coverage) [![Issue Count](https://camo.githubusercontent.com/c2d486ed0bd6fd0cf08a06e58b8cbb6531ff4b62e3600babad38947630af9d5a/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f4a656c6c652d532f7065726d75746174696f6e732f6261646765732f69737375655f636f756e742e737667)](https://codeclimate.com/github/Jelle-S/permutations)

```
use Jelle_S\Util\Permutation\LexographicalPermutation;
$number = 12345;
$next = LexographicalPermutation::getNextPermutation($number);
print "The next lexographical permutation of {$number} is {$next}.\n";

$number = 32154;
$previous = LexographicalPermutation::getPreviousPermutation($number);
print "The previous lexographical permutation of {$number} is {$previous}.\n";

$first = LexographicalPermutation::getFirstPermutation($number);
print "The first lexographical permutation of {$number} is {$first}.\n";

$last = LexographicalPermutation::getLastPermutation($number);
print "The last lexographical permutation of {$number} is {$last}.\n";

$number = 3124;
$all = print_r(LexographicalPermutation::getAllPermutations($number), TRUE);
print "All lexographical permutations of {$number} are \n{$all}\n";
```

Output:

```
The next lexographical permutation of 12345 is 12354.
The previous lexographical permutation of 32154 is 32145.
The first lexographical permutation of 32154 is 12345.
The last lexographical permutation of 32154 is 54321.
All lexographical permutations of 3124 are
Array
(
    [0] => 1234
    [1] => 1243
    [2] => 1324
    [3] => 1342
    [4] => 1423
    [5] => 1432
    [6] => 2134
    [7] => 2143
    [8] => 2314
    [9] => 2341
    [10] => 2413
    [11] => 2431
    [12] => 3124
    [13] => 3142
    [14] => 3214
    [15] => 3241
    [16] => 3412
    [17] => 3421
    [18] => 4123
    [19] => 4132
    [20] => 4213
    [21] => 4231
    [22] => 4312
    [23] => 4321
)

```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity65

Established project with proven stability

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

Total

2

Last Release

3472d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fd0af1f056fd3baa2df55c0c745ade4d0f8af99505f717bf0ad48d7b615a2153?d=identicon)[Jelle-S](/maintainers/Jelle-S)

---

Top Contributors

[![Jelle-S](https://avatars.githubusercontent.com/u/1828542?v=4)](https://github.com/Jelle-S "Jelle-S (22 commits)")

### Embed Badge

![Health badge](/badges/jelle-s-permutations/health.svg)

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

###  Alternatives

[ausi/slug-generator

Slug Generator

8002.3M24](/packages/ausi-slug-generator)[illuminate/cookie

The Illuminate Cookie package.

224.5M132](/packages/illuminate-cookie)[jolicode/php-os-helper

Helpers to detect the OS of the machine where PHP is running.

213.1M6](/packages/jolicode-php-os-helper)

PHPackages © 2026

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