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

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

zonuexe/phactory
================

A Database Factory for PHP Unit Tests

v0.5.0(10y ago)011Apache-2.0PHPPHP &gt;= 5.4.0

Since Aug 21Pushed 10y ago1 watchersCompare

[ Source](https://github.com/BaguettePHP/phactory)[ Packagist](https://packagist.org/packages/zonuexe/phactory)[ Docs](http://phactory.org)[ RSS](/packages/zonuexe-phactory/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (2)Versions (7)Used By (0)

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

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

[![Build Status](https://camo.githubusercontent.com/c41ff26518f2fa0eac794c2be1404ae129015296c76180058509c42f99630c2f/68747470733a2f2f7472617669732d63692e6f72672f42616775657474655048502f70686163746f72792e737667)](https://travis-ci.org/BaguettePHP/phactory)[![Package version](https://camo.githubusercontent.com/982641230fb15d04a819a0d6919ce3e2fa3b3a9016ea60023dc94e483d0637f7/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a6f6e756578652f70686163746f72792e737667)](https://packagist.org/packages/zonuexe/objectsystem)[![Apache License 2.0](https://camo.githubusercontent.com/54c5af37712abe12d8b4bfee2fdad92e184f24d37a5bc99f26bfa9fbc460c456/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f42616775657474655048502f70686163746f72792e737667)](https://spdx.org/licenses/Apache-2.0)

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

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 53.5% 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 ~239 days

Recently: every ~299 days

Total

6

Last Release

3863d ago

PHP version history (2 changes)v0.4PHP &gt;=5.3.0

v0.5.0PHP &gt;= 5.4.0

### Community

Maintainers

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

---

Top Contributors

[![chriskite](https://avatars.githubusercontent.com/u/72308?v=4)](https://github.com/chriskite "chriskite (61 commits)")[![zonuexe](https://avatars.githubusercontent.com/u/822086?v=4)](https://github.com/zonuexe "zonuexe (23 commits)")[![jimbojsb](https://avatars.githubusercontent.com/u/107836?v=4)](https://github.com/jimbojsb "jimbojsb (9 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)")[![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)")[![ramsey](https://avatars.githubusercontent.com/u/42941?v=4)](https://github.com/ramsey "ramsey (2 commits)")[![maciej-bielski](https://avatars.githubusercontent.com/u/3303828?v=4)](https://github.com/maciej-bielski "maciej-bielski (1 commits)")[![cschwendiman](https://avatars.githubusercontent.com/u/403162?v=4)](https://github.com/cschwendiman "cschwendiman (1 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)")[![Lumbendil](https://avatars.githubusercontent.com/u/184785?v=4)](https://github.com/Lumbendil "Lumbendil (1 commits)")

---

Tags

testingdatabasemysqlsqlitemongodb

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[chriskite/phactory

A Database Factory for PHP Unit Tests

140218.6k8](/packages/chriskite-phactory)[dg/adminer-custom

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

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

PHPUnit extension that supports mongodb

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

Select MySQL compatibility functions for PDO's SQLite driver

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

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

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

Adminer database management tool for your Laravel application.

451.0k](/packages/moharrum-laravel-adminer)

PHPackages © 2026

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