PHPackages                             chriskite/phactory - 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. chriskite/phactory

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

chriskite/phactory
==================

A Database Factory for PHP Unit Tests

v0.4.3(12y ago)140216.9k↓30.8%38[12 issues](https://github.com/chriskite/phactory/issues)[5 PRs](https://github.com/chriskite/phactory/pulls)8PHPPHP &gt;=5.3.0

Since Aug 21Pushed 5y ago6 watchersCompare

[ Source](https://github.com/chriskite/phactory)[ Packagist](https://packagist.org/packages/chriskite/phactory)[ Docs](http://phactory.org)[ RSS](/packages/chriskite-phactory/feed)WikiDiscussions next Synced 1mo ago

READMEChangelogDependenciesVersions (6)Used By (8)

Phactory: PHP Database Object Factory for Unit Testing
======================================================

[](#phactory-php-database-object-factory-for-unit-testing)

What is it?
-----------

[](#what-is-it)

Phactory is an alternative to using database fixtures in your PHP unit tests. Instead of maintaining a separate XML file of data, you define a blueprint for each table, and then create as many different objects as you need.

Phactory was inspired by Factory Girl.

Features
--------

[](#features)

- Define default values for your table rows once with Phactory::define(), then easily create objects in that table with a call to Phactory::create().
- Create associations between your defined tables, and the objects will automatically be associated in the database upon creation.
- Use sequences to create unique values for each successive object you create.

Database Support
----------------

[](#database-support)

- MySQL
- Sqlite
- Postgresql

Language Support
----------------

[](#language-support)

- PHP &gt;= 5.3

Limitations
-----------

[](#limitations)

- Each table must have a single integer primary key for associations to work.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity49

Moderate usage in the ecosystem

Community32

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 65.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 ~107 days

Total

4

Last Release

4695d ago

### Community

Maintainers

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

---

Top Contributors

[![chriskite](https://avatars.githubusercontent.com/u/72308?v=4)](https://github.com/chriskite "chriskite (61 commits)")[![jimbojsb](https://avatars.githubusercontent.com/u/107836?v=4)](https://github.com/jimbojsb "jimbojsb (11 commits)")[![abarrera](https://avatars.githubusercontent.com/u/235122?v=4)](https://github.com/abarrera "abarrera (6 commits)")[![sebastianbergmann](https://avatars.githubusercontent.com/u/25218?v=4)](https://github.com/sebastianbergmann "sebastianbergmann (3 commits)")[![ramsey](https://avatars.githubusercontent.com/u/42941?v=4)](https://github.com/ramsey "ramsey (2 commits)")[![drock](https://avatars.githubusercontent.com/u/164126?v=4)](https://github.com/drock "drock (2 commits)")[![amsa](https://avatars.githubusercontent.com/u/1153498?v=4)](https://github.com/amsa "amsa (2 commits)")[![renebruns](https://avatars.githubusercontent.com/u/381730?v=4)](https://github.com/renebruns "renebruns (1 commits)")[![cgarvis](https://avatars.githubusercontent.com/u/213125?v=4)](https://github.com/cgarvis "cgarvis (1 commits)")[![trimbletodd](https://avatars.githubusercontent.com/u/684058?v=4)](https://github.com/trimbletodd "trimbletodd (1 commits)")[![cschwendiman](https://avatars.githubusercontent.com/u/403162?v=4)](https://github.com/cschwendiman "cschwendiman (1 commits)")[![Lumbendil](https://avatars.githubusercontent.com/u/184785?v=4)](https://github.com/Lumbendil "Lumbendil (1 commits)")[![maciej-bielski](https://avatars.githubusercontent.com/u/3303828?v=4)](https://github.com/maciej-bielski "maciej-bielski (1 commits)")

---

Tags

testingdatabasemysqlsqlitemongodb

### Embed Badge

![Health badge](/badges/chriskite-phactory/health.svg)

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

###  Alternatives

[dg/adminer-custom

Customization for Adminer, the best database management tool written in PHP.

134765.7k16](/packages/dg-adminer-custom)[zumba/mongounit

PHPUnit extension that supports mongodb

3198.6k1](/packages/zumba-mongounit)[vectorface/mysqlite

Select MySQL compatibility functions for PDO's SQLite driver

3639.5k1](/packages/vectorface-mysqlite)[dg/adminer

Customization for Adminer, the best database management tool written in PHP.

1342.5k](/packages/dg-adminer)[moharrum/laravel-adminer

Adminer database management tool for your Laravel application.

451.0k](/packages/moharrum-laravel-adminer)[sofa/eloquent-testsuite

Helpers for fast and reliable UNIT tests for your Eloquent Models with PHPUnit

10104.7k](/packages/sofa-eloquent-testsuite)

PHPackages © 2026

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