PHPackages                             rawr/phpunit-data-provider - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. rawr/phpunit-data-provider

ActiveLibrary[Testing &amp; Quality](/categories/testing)

rawr/phpunit-data-provider
==========================

Lightweight builder for PhpUnit data providers

3.3.1(1y ago)67365.3k↑38.3%5[1 PRs](https://github.com/t-regx/phpunit-data-provider/pulls)6MITPHPPHP &gt;=7.1.0CI passing

Since Jun 7Pushed 1y ago2 watchersCompare

[ Source](https://github.com/t-regx/phpunit-data-provider)[ Packagist](https://packagist.org/packages/rawr/phpunit-data-provider)[ GitHub Sponsors](https://github.com/danon)[ RSS](/packages/rawr-phpunit-data-provider/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (14)Used By (6)

[![](.github/assets/t.regx.png)](https://t-regx.com/)

Helper for PhpUnit @dataProvider
================================

[](#helper-for-phpunit-dataprovider)

Handy `require-dev` testing tool for [PhpUnit](https://github.com/sebastianbergmann/phpunit). It allows to manage data providers with `zip()`, `join()`, `cross()`, `pairs()`, `slice()`, `map()` and more.

[![Build Status](https://github.com/t-regx/CrossDataProviders/workflows/build/badge.svg?branch=master)](https://github.com/t-regx/CrossDataProviders/actions/)[![Coverage Status](https://camo.githubusercontent.com/f675d15c6f724fcbc71804a69735d9eb2ca65f0539dfb539eccd51f0b8f8d85e/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f742d726567782f43726f73734461746150726f7669646572732f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/t-regx/CrossDataProviders?branch=master)[![Dependencies](https://camo.githubusercontent.com/20f4b99a958aadb02ff273ac6428c17cf55c6b817657ed64b1c39c7f71955a0e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646570656e64656e636965732d302d627269676874677265656e2e737667)](https://github.com/t-regx/CrossDataProviders)[![License](https://camo.githubusercontent.com/141b730b31604503c69a2460dc91192b3f1d4bed2c715496ed82cc00742cdc18/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f742d726567782f43726f73734461746150726f7669646572732e737667)](https://github.com/t-regx/CrossDataProviders/blob/master/LICENSE)[![Composer lock](https://camo.githubusercontent.com/0bd6507f0299009d2952dd4e127b86982adf10e3660294d160686b896b279974/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2e6c6f636b2d756e636f6d6d697465642d677265656e2e737667)](https://github.com/t-regx/CrossDataProviders)

[![PHP Version](https://camo.githubusercontent.com/d29ceb6206232af72a55b5ed3e6fab0a1f2d6cb6c728a088c9c18c4b035a0765/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e312d626c75652e737667)](https://github.com/t-regx/CrossDataProviders/runs/2375602376)[![PHP Version](https://camo.githubusercontent.com/5180a354acf28fb748fbeddd95219b60e0145d1e0eac9f976ca9a1bc9bc0337b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e322d626c75652e737667)](https://github.com/t-regx/CrossDataProviders/runs/2375602376)[![PHP Version](https://camo.githubusercontent.com/de6ad351fa59d9e301ffc48de85e4ca23954b4ba5746f324991a43aab522f893/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e332d626c75652e737667)](https://github.com/t-regx/CrossDataProviders/runs/2375602376)[![PHP Version](https://camo.githubusercontent.com/8a0234efb25bffbee74e0444a52c7796dee73c2785c9908a8c05ecf6eb0f5ff3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e342d626c75652e737667)](https://github.com/t-regx/CrossDataProviders/runs/2375602376)[![PHP Version](https://camo.githubusercontent.com/82887c22962d0022d20f61e17b76e949b7c813ca52cd0b00e794487a1a951169/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e302d626c75652e737667)](https://github.com/t-regx/CrossDataProviders/runs/2375602376)[![PHP Version](https://camo.githubusercontent.com/55119e0553f52e25200843d20c0b7f94802872deee3c7737d4dcd41a851167c6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312d626c75652e737667)](https://github.com/t-regx/CrossDataProviders/runs/2375602376)[![PHP Version](https://camo.githubusercontent.com/731c0a72386365632f9a88847c496d04aa121df13cdcb8a3749ed01e8a7df8d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322d626c75652e737667)](https://github.com/t-regx/CrossDataProviders/runs/2375602376)[![PHP Version](https://camo.githubusercontent.com/397fdb003e1ce45ddaa601a46346dd54e077dac402e967bc3d6ebd5b5f3b30b1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332d626c75652e737667)](https://github.com/t-regx/CrossDataProviders/runs/2375602376)[![PHP Version](https://camo.githubusercontent.com/8954266cf3bb41de3961bc203636a79d9ab4299cf0d15590042cf148ae556fc6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e342d626c75652e737667)](https://github.com/t-regx/CrossDataProviders/runs/2375602376)

[![PRs Welcome](https://camo.githubusercontent.com/f521b8a3c3a0d013c2d37bfdc56de0a513e491926e02c6166a9dd36097d62145/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50522d77656c636f6d652d627269676874677265656e2e7376673f7374796c653d706f706f7574)](https://github.com/t-regx/CrossDataProviders/pulls)

1. [Installation](#installation)
    - [Composer](#installation)
2. [Overview](#overview)
    - [`DataProvider::list()`](#dataproviderlist)
    - [`DataProvider::join()`](#dataproviderjoin)
    - [`DataProvider::zip()`](#dataproviderzip)
    - [`DataProvider::cross()`](#dataprovidercross)
    - [`DataProvider::pairs()`](#dataproviderpairs)
    - [`DataProvider::of()`](#dataproviderof)
    - [`DataProvider::tuples()`](#dataprovidertuples)
    - [`DataProvider::dictionary()`](#dataproviderdictionary)
    - [`DataProvider.map()`](#dataprovidermap)
    - [`DataProvider.slice()`](#dataproviderslice)
    - [`DataProvider.entries()`](#dataproviderentries)
3. [Documentation](#documentation)
    - [Functionalities](#functionalities)
    - [Features](#features)
    - [Example](#example-usage)
    - [Advanced example](#advanced-usage)
4. [Migration](#migration-from-previous-version)

Installation
============

[](#installation)

Installation for PHP 7.1 and later:

```
composer require --dev rawr/phpunit-data-provider
```

Overview
========

[](#overview)

`DataProvider` can be used to build, compose and edit data providers to be used with [PhpUnit](https://github.com/sebastianbergmann/phpunit)by [@sebastianbergmann](https://github.com/sebastianbergmann).

### `DataProvider::list()`

[](#dataproviderlist)

`DataProvider::list()` provides a list of elements. Test is invoked each time with a single argument.

```
/**
 * @test
 * @dataProvider colors
 */
public function test(string $color): void {
  // your test here
}

public function colors(): DataProvider {
  return DataProvider::list('blue', 'yellow', 'red');
}
```

[![list.png](.github/assets/example/list.png)](.github/assets/example/list.png)

Additionally, `DataProvider::list()` [names](#names) rows based on values.

### `DataProvider::join()`

[](#dataproviderjoin)

Vertically join data providers together.

💡 Useful when two data providers are used in other tests, and a new test should use both of them.

```
/**
 * @test
 * @dataProvider colors
 */
public function test(string $color, string $thing): void {
  // your test here
}

public function colors(): DataProvider {
  return DataProvider::join($this->blueColors(), $this->yellowColors(), $this->redColors());
}

public function blueColors(): DataProvider {
  return DataProvider::tuples(
    ['blue', 'sky'],
    ['deep blue', 'ocean']
  );
}

public function yellowColors(): iterable {
  yield 'sun' => ['yellow', 'sun'];
}

public function redColors(): array {
  return [
    'apple' => ['red', 'apple']
  ];
}
```

[![join.png](.github/assets/example/join.png)](.github/assets/example/join.png)

Note:

- Only data provider with equal amounts of arguments in rows can be joined. `DataProvider.drop()` can be used to trim overflowing columns, or [`DataProvider::zip()`](#dataproviderzip) to widen data provider with less rows.

### `DataProvider::zip()`

[](#dataproviderzip)

Horizontally join data providers together.

💡 Useful for keeping data providers clean and simple.

```
/**
 * @test
 * @dataProvider colors
 */
public function test($blueColor, $blueThing, $adjective, Factory $factory): void {
  // your test here
}

public function colors(): DataProvider {
  return DataProvider::zip($this->blueThings(), $this->adjectives(), $this->factories());
}

public function blueThings(): DataProvider {
  return DataProvider::tuples(
    ['blue', 'ink'],
    ['light blue', 'shirt'],
    ['deep blue', 'ocean']
  );
}

public function adjectives(): iterable {
  return DataProvider::list('liquid', 'comfortable', 'majestic');
}

public function factories(): iterable {
  yield [new InkFactory()];
  yield [new ShirtFactory()];
  yield [new OceanFactory()];
}
```

[![zip.png](.github/assets/example/zip.png)](.github/assets/example/zip.png)

Note:

- Only data provider with equal amounts of rows can be zipped. `DataProvider.slice()` can be used to trim overflowing rows, or [`DataProvider::join()`](#dataproviderjoin) to prolong a shorter data provider.

### `DataProvider::cross()`

[](#dataprovidercross)

Creates a square matrix of given data providers.

💡 Useful for testing all combinations of arguments.

```
/**
 * @test
 * @dataProvider colorsAndThings
 */
public function test(string $color, string $shade): void {
  // your test here
}

public function colorsAndThings(): DataProvider {
  return DataProvider::cross($this->colors(), $this->things());
}

public function colors(): array {
  return [
    ['blue'], ['yellow'], ['red']
  ];
}

public function things(): iterable {
  return DataProvider::list('sky', 'sun', 'apple');
}
```

[![cross.png](.github/assets/example/cross.png)](.github/assets/example/cross.png)

### `DataProvider::pairs()`

[](#dataproviderpairs)

Calls test with two arguments. Each argument is paired with all of the other arguments. All rows are [named](#names)according to the arguments.

Example shows a test paring image formats:

```
/**
 * @test
 * @dataProvider formats
 */
public function shouldConvertFile(string $from, string $to): void {
  // your test here
}

public function formats(): array {
  return DataProviders::distinctPairs('png', 'jpg', 'bmp');
}
```

[![pairs.png](.github/assets/example/pairs.png)](.github/assets/example/pairs.png)

### `DataProvider::of()`

[](#dataproviderof)

Instantiates a `DataProvider` from a raw-array accepted by [PhpUnit](https://github.com/sebastianbergmann/phpunit).

```
public function example(): DataProvider {
  return DataProvider::of($this->rawArray());
}

public function rawArrayDataProvider(): array {
  return [
    'key' => ['argument 1', 'argument 2']
  ];
}
```

[![of.png](.github/assets/example/of.png)](.github/assets/example/of.png)

Notes:

- Also accepts [`iterable`](https://www.php.net/manual/en/language.types.iterable.php), [`\Generator`](https://www.php.net/manual/en/class.generator.php) and other [types accepted](#accepted-types) by [PhpUnit](https://github.com/sebastianbergmann/phpunit).

### `DataProvider::tuples()`

[](#dataprovidertuples)

Provide multiple arguments for each a test. `DataProvider::tuples()` [names](#names) each row based on the values.

```
/**
 * @test
 * @dataProvider colors
 */
public function test(string $color, string $thing): void {
  // your test here
}

public function colors(): DataProvider {
  return DataProvider::tuples(
    ['blue', 'sky'],
    ['yellow', 'sun'],
    ['red', 'apple']
  );
}
```

[![tuples.png](.github/assets/example/tuples.png)](.github/assets/example/tuples.png)

### `DataProvider::dictionary()`

[](#dataproviderdictionary)

Specify a single argument for test. [`DataProvider::dictionary()`](#dataproviderdictionary) [names](#names) each row based on the provided array key.

```
/**
 * @test
 * @dataProvider colors
 */
public function test(string $color): void {
  // your test here
}

public function colors(): DataProvider {
  return DataProvider::dictionary([
    'custom name 1' => 'blue',
    'custom name 2' => 'yellow',
    'custom name 3' => 'red'
  ]);
}
```

[![dictionary.png](.github/assets/example/dictionary.png)](.github/assets/example/dictionary.png)

In most cases, [`DataProvider::list()`](#dataproviderlist) or [`DataProvider::tuples()`](#dataprovidertuples) should be used to [name](#names)rows based on arguments. Method `DataProvider::dictionary()` is useful when the arguments are not self-explanatory:

```
public function ports(): DataProvider {
  return DataProvider::dictionary([
    'http'  => 80,
    'https' => 443,
    'ftp'   => 21
  ]);
}
```

### `DataProvider.map()`

[](#dataprovidermap)

Transform each row's values in `DataProvider` to any other set of values.

💡 Useful for separating providers content and their form.

```
/**
* @test
* @dataProvider folderIterators
*/
public function test(\Iterator $iterator, string $name): void {
  // your test here
}

public function folderIterators(): DataProvider {
  return $this->folders()->map(function (string $name, string $path): array {
      return [
          new \DirectoryIterator($path),
          $name
      ];
  });
}

public function folders(): DataProvider {
  return DataProvider::tuples(
      ['temporary', '/tmp'],
      ['user directory', '/home'],
      ['system resources', '/usr/bin']);
}
```

[![map.png](.github/assets/example/map.png)](.github/assets/example/map.png)

Notes:

- Names in `DataProvider` will be preserved.

### `DataProvider.slice()`

[](#dataproviderslice)

Remove leading or trailing rows from `DataProvider`.

💡 Useful for adapting `DataProvider` to be zipped or limit provided values.

```
/**
 * @test
 * @dataProvider limitedColors
 */
public function test(string $color, string $thing): void {
  // your test here
}

public function limitedColors(): DataProvider {
    return $this->colors()->slice(0, 2);
}

public function colors(): DataProvider {
  return DataProvider::tuples(
    ['blue', 'sky'],
    ['yellow', 'sun'],
    ['red', 'apple']
  );
}
```

### `DataProvider.entries()`

[](#dataproviderentries)

Provide two arguments for each a test, from key-value pairs. `DataProvider::entries()` [names](#names) each row based on the key-value pair.

```
/**
 * @test
 * @dataProvider colors
 */
public function test(string $color, string $thing): void {
  // your test here
}

public function colors(): DataProvider {
  return DataProvider::entries(
    'blue'   => 'sky',
    'yellow' => 'sun',
    'red'    => 'apple',
  );
}
```

[![entries.png](.github/assets/example/entries.png)](.github/assets/example/entries.png)

Documentation
=============

[](#documentation)

### Functionalities

[](#functionalities)

- Creating new data providers:

    - [`DataProvider::list()`](#dataproviderlist), [`DataProvider::tuples()`](#dataprovidertuples), [`DataProvider::dictionary()`](#dataproviderdictionary), [`DataProvider::pairs()`](#dataproviderpairs), [`DataProvider::distinctPairs()`](#dataproviderpairs)
- Composing existing providers:

    - [`DataProvider::zip()`](#dataproviderzip), [`DataProvider::join()`](#dataproviderjoin), [`DataProvider::cross()`](#dataprovidercross), [`DataProvider::of()`](#dataproviderof)
- Editing existing providers:

    - [`DataProvider.map()`](#dataprovidermap), [`DataProvider.slice()`](#dataproviderslice), `DataProvider.drop()`. These methods don't modify `DataProvider`instance, but return a new instance.

### Features

[](#features)

- Clear naming
    - Each `DataProvider` builder sets proper [names](#names) for rows, based on values.
- Duplicate keys:
    - Duplicate keys are properly handled and formatted in an informative manner. No rows are ever being "lost" when editing.
- Lazy evaluation:
    - Iterators are being evaluated only when called. Argument iterators are only called once, even if `DataProvider` is called multiple times.
- `DataProvider` accepts many [provider types](#accepted-types).

### Names

[](#names)

`DataProvider` sets proper names for each row based on values.

```
/**
 * @test
 * @dataProvider colors
 */
public function test(string $color, string $thing): void {
  // your test here
}

public function colors(): DataProvider {
  return DataProvider::tuples(
    ['blue', 'sky'],
    ['yellow', 'sun'],
    ['red', 'apple']
  );
}
```

[![names](.github/assets/screen/names.dark.png#gh-dark-mode-only)](.github/assets/screen/names.dark.png#gh-dark-mode-only)[![names](.github/assets/screen/names.light.png#gh-light-mode-only)](.github/assets/screen/names.light.png#gh-light-mode-only)

Example usage
-------------

[](#example-usage)

[`DataProvider::cross()`](#dataprovidercross) returns an instance of `DataProvider` which is a square matrix of input data providers.

```
/**
 * @test
 * @dataProvider services
 */
public function shouldLogin(string $service, string $method, int $port): void {
  // your test here
}

public function services(): DataProvider {
  return DataProvider::cross(
    [
      ['github.com'], ['bitbucket.com'], ['gitlab.com'], ['sourceforge.net']
    ],
    [
      ['http', 80],
      ['https', 443],
      ['ssh', 22]
    ]);
}
```

This is equivalent of having a regular data provider that is composed of 12 entries, similar to:

```
public function services(): array {
  return [
    ['github.com', 'http', 80],
    ['github.com', 'https', 443],
    ['github.com', 'ssh', 22],
    ['bitbucket.com', 'http', 80],
    ['bitbucket.com', 'https', 443],
    ['bitbucket.com', 'ssh', 22],
    ['gitlab.com', 'http', 80],
    ['gitlab.com', 'https', 443],
    ['gitlab.com', 'ssh', 22],
    ['sourceforge.net', 'http', 80],
    ['sourceforge.net', 'https', 443],
    ['sourceforge.net', 'ssh', 22],
  ];
}
```

`DataProvider::cross()` accepts data providers of different types: [`array`](https://www.php.net/manual/en/language.types.array.php), [`\Iterator`](https://www.php.net/manual/en/class.iterator.php), [`\IteratorAggregate`](https://www.php.net/manual/en/class.iteratoraggregate.php), [`\Traversable`](https://www.php.net/manual/en/class.traversable.php), [`\Generator`](https://www.php.net/manual/en/class.generator.php), [`iterable`](https://www.php.net/manual/en/language.types.iterable.php) and `DataProvider`.

That means `DataProvider` can be composed together.

```
public function services(): DataProvider {
  return DataProvider::cross(
    DataProvider::list('github.com', 'bitbucket.com', 'gitlab.com', 'sourceforge.net'),
    DataProvider::tuples(['http', 80], ['https', 443], ['ssh', 22]));
}
```

Advanced usage
--------------

[](#advanced-usage)

`DataProvider` can be combined with other `DataProvider`s as well as regular [PhpUnit](https://github.com/sebastianbergmann/phpunit) data providers.

```
/**
 * @test
 * @dataProvider urls
 */
public function test0(string $url): void {
  // your test here
}

/**
 * @test
 * @dataProvider services
 */
public function test1(string $url, string $name, string $method, int $port): void {
  // your test here
}

/**
 * @test
 * @dataProvider allServices
 */
public function test2(string $url, string $name, string $method, int $port): void {
  // your test here
}

public function urls(): DataProvider {
  return DataProvider::list('github.com', 'bitbucket.com', 'gitlab.com', 'sourceforge.net');
}

public function rawArrayProvider(): array {
  return [
    ['GitHub'],
    ['BitBucket'],
    ['GitLab'],
    ['SourceForge']
  ];
}

public function services(): DataProvider {
  return DataProvider::cross(
    DataProvider::zip($this->urls(), $this->rawArrayProvider()),
    DataProvider::tuples(
      ['http', 80],
      ['https', 443],
      ['ssh', 22]));
}

public function allServices(): DataProvider {
  return DataProvider::join(
    $this->services(),
    $this->localServices()
  );
}

public function localServices(): array {
   return [
     'my local service' => ['localhost', 'local', 'http', '80']
   ];
}
```

### Accepted types

[](#accepted-types)

`DataProvider` accepts any type of data provider:

- all types allowed by [PhpUnit](https://github.com/sebastianbergmann/phpunit): [`array`](https://www.php.net/manual/en/language.types.array.php), [`iterable`](https://www.php.net/manual/en/language.types.iterable.php), [`\Traversable`](https://www.php.net/manual/en/class.traversable.php), [`\Iterator`](https://www.php.net/manual/en/class.iterator.php), [`\IteratorAggregate`](https://www.php.net/manual/en/class.iteratoraggregate.php), [`\Generator`](https://www.php.net/manual/en/class.generator.php)
- `DataProvider` itself, allowing data providers to be composed together

### Notes

[](#notes)

Notes on [`DataProvider::join()`](#dataproviderjoin):

- [`DataProvider::join()`](#dataproviderjoin) preserves names of each data provider, and also joins the names vertically. Duplicates in titles are preserved and presented appropriately.
- [`DataProvider::join()`](#dataproviderjoin) accepts [any type](#accepted-types) of data-provider.
- [`DataProvider::join()`](#dataproviderjoin) is conceptually similar to calling [`\array_merge()`](https://www.php.net/manual/en/function.array-merge.php) on raw-array providers, but [`\array_merge()`](https://www.php.net/manual/en/function.array-merge.php) would override duplicate keys, while [`DataProvider::join()`](#dataproviderjoin) preserves duplicate keys, and titles them appropriately.
- [`DataProvider::join()`](#dataproviderjoin) variadic arguments `...iterable` and can be used to join many data providers
- [`DataProvider::join()`](#dataproviderjoin) can only join data providers with the same amount of arguments in each row, otherwise `IrregularDataProviderException` is thrown.
- [`DataProvider::join()`](#dataproviderjoin) accepts `DataProvider` or other [`iterable`](https://www.php.net/manual/en/language.types.iterable.php) accepted by [PhpUnit](https://github.com/sebastianbergmann/phpunit). If improper data-provider is passed, `MalformedDataProviderException`is thrown.

Notes on [`DataProvider::zip()`](#dataproviderzip):

- [`DataProvider::zip()`](#dataproviderzip) preserves names of each data provider, and also joins them horizontally.
- [`DataProvider::zip()`](#dataproviderzip) accepts [any type](#accepted-types) of data-provider.
- [`DataProvider::zip()`](#dataproviderzip) variadic arguments `...iterable` and can zip many data providers
- [`DataProvider::zip()`](#dataproviderzip) can only zip data providers with the same amount of rows, otherwise `IrregularDataProviderException` is thrown. Additionally, each particular data provider must have the same amount of arguments in each row.
- `DataProvider::zip()` accepts `DataProvider` or other `iterable` accepted by [PhpUnit](https://github.com/sebastianbergmann/phpunit). If improper data-provider is passed, `MalformedDataProviderException`is thrown.

Note on [`DataProvider::pairs()`](#dataproviderpairs):

- `DataProvider::pairs()` produces duplicate [pairs](#dataproviderpairs) (for example `'png', 'png'`), while `DataProvider::distinctPairs()`only makes pairs of different arguments.

Note on [`DataProvider::tuples()`](#dataprovidertuples):

- `DataProvider::tuples()` is similar to `DataProvider::of()`, but `::of()` accepts an explicit name, while `DataProvider::tuples()` titles the rows according to the values in the row.

Migration from previous version
===============================

[](#migration-from-previous-version)

To use version `3.0.0`, migrating from [`2.4.0`](https://github.com/t-regx/CrossDataProviders/releases/tag/2.1.0) or earlier:

- Library namespace changed from `\TRegx\DataProvider\ ` to `\TRegx\PhpUnit\DataProviders\ `.
- Change `\TRegx\DataProvider\DataProviders::cross()` to `\TRegx\PhpUnit\DataProviders\DataProvider::cross()`.
- Change `\TRegx\DataProvider\CrossDataProviders::cross()` to `\TRegx\PhpUnit\DataProviders\DataProvider::cross()`.
- Change your data providers return type from `array` to `iterable` or `\TRegx\PhpUnit\DataProviders\DataProvider`.
- Removed `\TRegx\DataProvider\CrossDataProviders::builder()`, use `\TRegx\PhpUnit\DataProviders\DataProvider::cross()`instead.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance41

Moderate activity, may be stable

Popularity49

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity61

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

Recently: every ~131 days

Total

11

Last Release

488d ago

Major Versions

1.0.0 → 2.0.02019-10-19

2.4.0 → 3.0.02023-08-08

PHP version history (6 changes)1.0.0PHP &gt;=5.6

2.1.0PHP &gt;=7.0

2.2.0PHP ^7.0

v2.3.0PHP ^8.0 || ^7.0

2.4.0PHP ^7.1 || ^8.0

3.0.0PHP &gt;=7.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0f388dbecf863b7cf5131dbac972514dab843f609977315694b9f25e0e63332d?d=identicon)[danon](/maintainers/danon)

---

Top Contributors

[![danon](https://avatars.githubusercontent.com/u/13367735?v=4)](https://github.com/danon "danon (53 commits)")

---

Tags

data-providerdata-providersphpphpunit

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rawr-phpunit-data-provider/health.svg)

```
[![Health](https://phpackages.com/badges/rawr-phpunit-data-provider/health.svg)](https://phpackages.com/packages/rawr-phpunit-data-provider)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[phpspec/phpspec

Specification-oriented BDD framework for PHP 7.1+

1.9k36.7M3.1k](/packages/phpspec-phpspec)

PHPackages © 2026

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