PHPackages                             phpmachinist/phpmachinist - 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. phpmachinist/phpmachinist

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

phpmachinist/phpmachinist
=========================

Testing object factory for PHP

v3.2.0(11y ago)3630.7k5[12 issues](https://github.com/derptest/phpmachinist/issues)MITPHPPHP &gt;5.3.0

Since May 24Pushed 7y ago4 watchersCompare

[ Source](https://github.com/derptest/phpmachinist)[ Packagist](https://packagist.org/packages/phpmachinist/phpmachinist)[ RSS](/packages/phpmachinist-phpmachinist/feed)WikiDiscussions master Synced 1mo ago

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

[![Build Status](https://camo.githubusercontent.com/5633fc44d3780e3338b5617928e2c1f163cc10074cca29121a51c9a8a38fdb17/68747470733a2f2f7472617669732d63692e6f72672f64657270746573742f7068706d616368696e6973742e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/derptest/phpmachinist)[![SensioLabsInsight](https://camo.githubusercontent.com/87fa6e961dc0f5e48e471b657cd0f522d0050ac317ef603daee99d6b275b4996/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f36383866393866622d393966392d346333372d623264322d6638313766383436663939322f6d696e692e706e67)](https://insight.sensiolabs.com/projects/688f98fb-99f9-4c37-b2d2-f817f846f992)

PHPMachinist: Testing Object Factory
====================================

[](#phpmachinist-testing-object-factory)

What???!??!
-----------

[](#what)

A Slightly less annoying way of creating database fixtures for PHP testing. It borrows heavily from several projects:

-
- [https://github.com/thoughtbot/factory\_girl](https://github.com/thoughtbot/factory_girl)
-
-

They're totally awesome. Just either in the wrong language, or didn't quite do what I wanted.

Hip Hop VM (HHVM) Support
-------------------------

[](#hip-hop-vm-hhvm-support)

Hip Hop VM is supported and tested. If you want to use the Doctrine store, it will require Doctrine ORM 2.4.x or newer.

Data Store Support
------------------

[](#data-store-support)

The following data stores are currently supported:

- PDO
    - MySQL
    - SQLite
- Doctrine 2 ORM

Install
-------

[](#install)

Add the package derptest/phpmachinist to your composer.json For more information about Composer, please visit

Configure
---------

[](#configure)

Configuration of PHP Machinist happens in two steps:

1. Register data stores

    Registering data stores is done via either the static `Machinist::store()` method or the `addStore()` method on a Machinist instance. Both methods take the same parameters, a `StoreInterface`instance and an optional name for that store. If no name is given, it will default to `default`. Below is an example of both:

    ```
