PHPackages                             th3n3rd/cartesian-product - 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. th3n3rd/cartesian-product

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

th3n3rd/cartesian-product
=========================

Memory efficient Cartesian Product implementation

v1.0.0(2mo ago)13102.8k—0%52MITPHPPHP &gt;=8.0CI passing

Since Apr 18Pushed 1mo agoCompare

[ Source](https://github.com/th3n3rd/cartesian-product)[ Packagist](https://packagist.org/packages/th3n3rd/cartesian-product)[ RSS](/packages/th3n3rd-cartesian-product/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (5)Used By (2)

Cartesian Product
=================

[](#cartesian-product)

[![Latest Version](https://camo.githubusercontent.com/c394bf51b2ac92a060ada12ec5ecd99610a2c928ad05fbf042b7fc4578c16625/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7468336e3372642f63617274657369616e2d70726f647563742e7376673f7374796c653d666c61742d737175617265)](https://github.com/th3n3rd/cartesian-product/releases)[![Build Status](https://github.com/th3n3rd/cartesian-product/actions/workflows/ci.yml/badge.svg)](https://github.com/th3n3rd/cartesian-product/actions/workflows/ci.yml)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Total Downloads](https://camo.githubusercontent.com/b6ad178f1d7d66ed9d3ef392482bf7628b6c7325b9dd421c8d6b787ff683b171/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7468336e3372642f63617274657369616e2d70726f647563742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/th3n3rd/cartesian-product)

**Memory efficient Cartesian Product implementation.**

It uses iterators in order to store only a specific tuple at a time, being able to compute even large combinations without affecting the memory footprint.

Install
-------

[](#install)

Via Composer

```
$ composer require th3n3rd/cartesian-product
```

Usage
-----

[](#usage)

The library can be used as an iterator:

```
use Nerd\CartesianProduct\CartesianProduct;

$cartesianProduct = CartesianProduct::empty()
    ->with(['a', 'b', 'c'])
    ->with(['d', 'e'])
;

// or you can use the `of` static method:
$cartesianProduct = CartesianProduct::of([
    ['a', 'b', 'c'],
    ['d', 'e'],
]);

foreach ($cartesianProduct as $index => $product) {
    printf("[%s] (%s)\n", $index, implode(',', $product));
}
```

You can also compute the whole result at once (not recommended for large sets):

```
$result = $cartesianProduct->toArray();
```

Testing
-------

[](#testing)

```
$ vendor/bin/phpunit
```

License
-------

[](#license)

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

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance89

Actively maintained with recent releases

Popularity40

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 80.6% 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 ~1328 days

Total

4

Last Release

63d ago

Major Versions

v0.3.0 → v1.0.02026-03-16

PHP version history (2 changes)v0.1.0PHP &gt;=5.3.3

v1.0.0PHP &gt;=8.0

### Community

Maintainers

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

---

Top Contributors

[![th3n3rd](https://avatars.githubusercontent.com/u/2188427?v=4)](https://github.com/th3n3rd "th3n3rd (25 commits)")[![sagikazarmark](https://avatars.githubusercontent.com/u/1226384?v=4)](https://github.com/sagikazarmark "sagikazarmark (5 commits)")[![Chris53897](https://avatars.githubusercontent.com/u/7104259?v=4)](https://github.com/Chris53897 "Chris53897 (1 commits)")

---

Tags

productcartesian

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/th3n3rd-cartesian-product/health.svg)

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

###  Alternatives

[akeneo-labs/pim-enhanced-connector

Provides PIM product reader with more option (choice on completeness, choice on enabled, delta based on last export time)

2135.6k](/packages/akeneo-labs-pim-enhanced-connector)

PHPackages © 2026

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