PHPackages                             mrkrstphr/dbunit-fixture-arrays - 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. mrkrstphr/dbunit-fixture-arrays

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

mrkrstphr/dbunit-fixture-arrays
===============================

PHPUnit DbUnit Native Array-based Fixtures

v1.0.0(11y ago)61.4k3MITPHPPHP &gt;=5.5

Since Aug 15Pushed 7y ago1 watchersCompare

[ Source](https://github.com/mrkrstphr/dbunit-fixture-arrays)[ Packagist](https://packagist.org/packages/mrkrstphr/dbunit-fixture-arrays)[ Docs](http://github.com/mrkrstphr/dbunit-fixture-arrays)[ RSS](/packages/mrkrstphr-dbunit-fixture-arrays/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

dbunit-fixture-arrays
=====================

[](#dbunit-fixture-arrays)

> A native PHP array-based fixture provider for PHPUnit's DbUnit

[![build status](https://camo.githubusercontent.com/e0c4c7b82bd2e632a677dcb2ef67d6c707e7d139d6622ecf78781769e0ad72d3/68747470733a2f2f6170692e7472617669732d63692e6f72672f6d726b7273747068722f6462756e69742d666978747572652d6172726179732e737667)](https://camo.githubusercontent.com/e0c4c7b82bd2e632a677dcb2ef67d6c707e7d139d6622ecf78781769e0ad72d3/68747470733a2f2f6170692e7472617669732d63692e6f72672f6d726b7273747068722f6462756e69742d666978747572652d6172726179732e737667)

dbunit-fixture-arrays provides the capability to provide fixtures (data sets) to PHPUnit's DbUnit as native PHP arrays, as opposed to the many other drivers currently supported by DbUnit, such as Yaml, XML, CSV, etc.

How?
----

[](#how)

Simply install with composer:

```
composer require mrkrstphr/dbunit-fixture-arrays:@stable

```

Then plug into DbUnit as you would with any other data set format:

```
public function getDataSet() {
    return new ArrayDataSet([
        '/path_to_file.php',
        '/path_to_other_file.php'
    ]);
}
```

Where the files look something like:

```
return [
    'table_name' => [
        ['id' => 1, 'name' => 'Row Data 1'],
        ['id' => 2, 'name' => 'Row Data 2'],
    ],
    'other_table_name' => [
        ['id' => 99, 'color' => 'Red'],
        ['id' => 88, 'color' => 'Blue'],
    ],
];
```

Why?
----

[](#why)

Sometimes it's nice to be able to slip a little logic into the fixtures files. Say for instance that you need some test data that contains a date in the future, but not more than 1 year away. Without continually updating your fixture data, there's no way to reliably do this.

With dbunit-fixture-arrays, you can:

```
return [
    'table_name' => [
        ['id' => 1, 'date' => (new DateTime('+1 year'))->format('Y-m-d')],
        ['id' => 2, 'date' => '2014-05-01'
    ]
];
```

Other benefits include slightly, but probably not very noticably, faster tests with less memory footprint due to not needing to parse Yaml or XML - your results may vary.

Contributing
------------

[](#contributing)

Suggestions or bugs? Submit an issue or open a pull request!

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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

4288d ago

### Community

Maintainers

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

---

Top Contributors

[![mrkrstphr](https://avatars.githubusercontent.com/u/164472?v=4)](https://github.com/mrkrstphr "mrkrstphr (6 commits)")[![najamhaq](https://avatars.githubusercontent.com/u/1304405?v=4)](https://github.com/najamhaq "najamhaq (1 commits)")

---

Tags

phpunitdbUnit

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/mrkrstphr-dbunit-fixture-arrays/health.svg)

```
[![Health](https://phpackages.com/badges/mrkrstphr-dbunit-fixture-arrays/health.svg)](https://phpackages.com/packages/mrkrstphr-dbunit-fixture-arrays)
```

###  Alternatives

[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[johnkary/phpunit-speedtrap

Find and report on slow tests in your PHPUnit test suite

78137.2M122](/packages/johnkary-phpunit-speedtrap)[spatie/phpunit-snapshot-assertions

Snapshot testing with PHPUnit

69417.9M510](/packages/spatie-phpunit-snapshot-assertions)[phpspec/prophecy-phpunit

Integrating the Prophecy mocking library in PHPUnit test cases

19254.9M1.4k](/packages/phpspec-prophecy-phpunit)[yoast/phpunit-polyfills

Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests

18338.5M841](/packages/yoast-phpunit-polyfills)[ergebnis/phpunit-slow-test-detector

Provides facilities for detecting slow tests in phpunit/phpunit.

1468.1M72](/packages/ergebnis-phpunit-slow-test-detector)

PHPackages © 2026

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