PHPackages                             petrgrishin/create-matrix - 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. petrgrishin/create-matrix

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

petrgrishin/create-matrix
=========================

Helper for create matrix

36PHP

Since Mar 3Pushed 11y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

create-matrix
=============

[](#create-matrix)

[![Travis CI](https://camo.githubusercontent.com/d98f3bf035bf7d7241c90f4c0843f6c143612aa3e07fedae39447ae44c8aaf32/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f706574726772697368696e2f6372656174652d6d61747269782f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/petrgrishin/create-matrix)

Helper for create matrix

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

[](#installation)

Add a dependency to your project's composer.json file if you use [Composer](http://getcomposer.org/) to manage the dependencies of your project:

```
{
    "require": {
        "petrgrishin/create-matrix": "~1.0"
    }
}
```

Usage examples
--------------

[](#usage-examples)

#### Create matrix by the variants

[](#create-matrix-by-the-variants)

```
$variants = [
    'a' => [1, 2],
    'b' => [10, 20],
];
$matrix = CreateMatrix::byVariants($variants)->getArray();

// result
$matrix = Array
(
    [0] => Array
        (
            [a] => 1
            [b] => 10
        )

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

    [2] => Array
        (
            [a] => 2
            [b] => 10
        )

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

)
```

#### Create matrix with variant an empty value

[](#create-matrix-with-variant-an-empty-value)

```
$variants = [
    'a' => [1, null],
    'b' => [10, null],
];
$matrix = CreateMatrix::byVariants($variants)->getArray();

// result
$matrix = Array
(
    [0] => Array
        (
            [a] => 1
            [b] => 10
        )

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

    [2] => Array
        (
            [a] =>
            [b] => 10
        )

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

)
```

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/580229?v=4)[Petr Grishin](/maintainers/petrgrishin)[@petrgrishin](https://github.com/petrgrishin)

---

Top Contributors

[![petrgrishin](https://avatars.githubusercontent.com/u/580229?v=4)](https://github.com/petrgrishin "petrgrishin (12 commits)")

### Embed Badge

![Health badge](/badges/petrgrishin-create-matrix/health.svg)

```
[![Health](https://phpackages.com/badges/petrgrishin-create-matrix/health.svg)](https://phpackages.com/packages/petrgrishin-create-matrix)
```

PHPackages © 2026

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