PHPackages                             kevinsimard/combinatorics - 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. kevinsimard/combinatorics

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

kevinsimard/combinatorics
=========================

Mathematical algorithms concerning the study of finite or countable discrete structures.

v1.0.5(10y ago)226[1 issues](https://github.com/kevinsimard/combinatorics/issues)MITPHPPHP &gt;=5.5.0

Since Apr 7Pushed 8y ago1 watchersCompare

[ Source](https://github.com/kevinsimard/combinatorics)[ Packagist](https://packagist.org/packages/kevinsimard/combinatorics)[ RSS](/packages/kevinsimard-combinatorics/feed)WikiDiscussions master Synced 3w ago

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

Combinatorics
=============

[](#combinatorics)

[![Build Status](https://camo.githubusercontent.com/06f70192b7ff4b0c835da255a7091bfe511c067a928b010c4407d5a3a8233af2/68747470733a2f2f7472617669732d63692e6f72672f6b6576696e73696d6172642f636f6d62696e61746f726963732e737667)](https://travis-ci.org/kevinsimard/combinatorics)

Usage
-----

[](#usage)

You may add new elements to the list by using the `add` method:

```
$instance = new Combinatorics(["foo", "bar"]);

$instance->add("baz");
$instance->add("qux");

// ["foo", "bar", "baz", "qux"]
```

You may also want to reset the list of elements by calling the `reset` method:

```
$instance = new Combinatorics(["foo", "bar"]);

$instance->reset();

// []
```

### Permutations

[](#permutations)

```
$elements = ["foo", "bar", "baz"];

$instance = new Combinatorics($elements);
foreach ($instance->permutations() as $value) {
    ...
}

// OR

foreach (Combinatorics::permutations($elements) as $value) {
    ...
}

// [
//     ["foo", "bar", "baz"],
//     ["bar", "foo", "baz"],
//     ["bar", "baz", "foo"],
//     ["foo", "baz", "bar"],
//     ["baz", "foo", "bar"],
//     ["baz", "bar", "foo"]
// ]
```

Structure
---------

[](#structure)

```
├── src
│   └── Combinatorics.php
├── tests
│   └── CombinatoricsTest.php
├── .editorconfig
├── .gitattributes
├── .gitignore
├── .travis.yml
├── LICENSE.md
├── README.md
├── composer.json
├── composer.lock
└── phpunit.xml

```

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3736d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/331c9f437fb6ec97ec6f57839e210589b92edc68d56c048b3edcf31de97a1432?d=identicon)[kevinsimard](/maintainers/kevinsimard)

---

Top Contributors

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

---

Tags

algorithmscombinatoricsphpmathematicalpermutationsalgorithms

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[clue/graph

GraPHP is the mathematical graph/network library written in PHP.

7144.4M43](/packages/clue-graph)[graphp/graph

GraPHP is the mathematical graph/network library written in PHP.

714305.2k4](/packages/graphp-graph)[doganoo/php-algorithms

A collection of common algorithms implemented in PHP. The collection is based on "Cracking the Coding Interview" by Gayle Laakmann McDowell

9455.8k7](/packages/doganoo-php-algorithms)[drupol/phpermutations

Generators and iterators, permutations and combinations.

80713.5k5](/packages/drupol-phpermutations)[nepster-web/gambling-tech

Gambling Algorithms for Certification.

122.0k](/packages/nepster-web-gambling-tech)

PHPackages © 2026

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