zonuexe / phactory
A Database Factory for PHP Unit Tests
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 38
Open Issues: 0
pkg:composer/zonuexe/phactory
Requires
- php: >= 5.4.0
- doctrine/inflector: ^1.1
Requires (Dev)
- ext-pdo: *
- phpunit/phpunit: ^4.8.19
This package is not auto-updated.
Last update: 2025-10-11 23:48:48 UTC
README
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
- 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
- MySQL
- Sqlite
- Postgresql
Language Support
- PHP >= 5.3
Limitations
- Each table must have a single integer primary key for associations to work.