PHPackages                             ahungry/powerset - 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. ahungry/powerset

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

ahungry/powerset
================

Generate a powerset (enumerate all possible values) of a multi-dimensional array

0.2.0(8y ago)1195GPL-3.0-or-laterPHP

Since Jun 29Pushed 8y ago1 watchersCompare

[ Source](https://github.com/ahungry/ahungry-powerset)[ Packagist](https://packagist.org/packages/ahungry/powerset)[ RSS](/packages/ahungry-powerset/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (7)Used By (0)

Ahungry Powerset
================

[](#ahungry-powerset)

This is a PHP package that allows you to generate a power set (enumerate all possible values) of a multi-dimensional array.

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

[](#installation)

Watch for this to be available on packagist, at which point you can install with (update: its on packagist now!):

```
composer require ahungry/powerset

```

But in the meantime, to install, clone the repository via:

```
git clone https://github.com/ahungry/ahungry-powerset.git

```

and include the file, or add a new VCS reference in your composer.json as such:

```
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/ahungry/ahungry-powerset"
        }
    ],
    "require": {
        "ahungry/powerset": "^0.1"
    }
```

then follow it up with a:

```
composer update

```

### Using ahungry-powerset

[](#using-ahungry-powerset)

After requiring it (or auto-loading it with composer), you can use it (see blub.php for a sample) via:

```
use Com\Ahungry\Powerset\Functions as pset;

$b = [[
    'a' => [1,2],
    'b' => [3,4],
]];

pset\powerSet($b);

print_r($b);
```

which will then produce the following output:

```
Array
(
    [0] => Array
        (
            [a] => 2
            [b] => 4
        )

    [1] => Array
        (
            [a] => 2
            [b] => 3
        )

    [2] => Array
        (
            [a] => 1
            [b] => 4
        )

    [3] => Array
        (
            [a] => 1
            [b] => 3
        )

)
```

Oh, and it will work with nested arrays:

```
    $a = [[
        'a' => 0,
        'x' => [
          ['b' => 1, 'c' => ['a', 'b', 'c']],
          ['b' => 3, 'c' => ['a', 'b', 'c']],
          ['b' => 5, 'c' => ['a', 'b', 'c']],
        ],
        'y' => [7, 8, 9],
      ]];

    ps\powerSet($a);
    $this->assertCount(27, $a); // true
```

TODO
----

[](#todo)

- Get package listed on packagist
- Generate a true power set (include the empty value possibilities)

License
-------

[](#license)

GPLv3

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Recently: every ~146 days

Total

6

Last Release

3067d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10437774?v=4)[Matthew Carter](/maintainers/ahungry)[@ahungry](https://github.com/ahungry)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[icanhazstring/systemctl-php

PHP wrapper for systemctl

7318.0k1](/packages/icanhazstring-systemctl-php)

PHPackages © 2026

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