PHPackages                             sadovnik/yii2-factory-muffin - 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. sadovnik/yii2-factory-muffin

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

sadovnik/yii2-factory-muffin
============================

A Yii2 wrapper for league/factory-muffin with Gii generators.

1.0.0(9y ago)06MITPHPPHP &gt;=5.5.0

Since May 16Pushed 9y ago1 watchersCompare

[ Source](https://github.com/sadovnik/temp-yii2-factory-muffin)[ Packagist](https://packagist.org/packages/sadovnik/yii2-factory-muffin)[ Docs](http://moody.website/yii2-factory-muffin/)[ RSS](/packages/sadovnik-yii2-factory-muffin/feed)WikiDiscussions master Synced 2mo ago

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

Yii2 Extension for [Factory Muffin](https://github.com/thephpleague/factory-muffin)
===================================================================================

[](#yii2-extension-for-factory-muffin)

[![Total Downloads](https://camo.githubusercontent.com/00766252708de8a3086f350da8d6dd46f63a3cace1b795e1aeedf803c8ee039c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73616164612f796969322d666163746f72792d6d756666696e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/saada/yii2-factory-muffin) [![Software License](https://camo.githubusercontent.com/b37fbf1d9e70438f48ceb1f4a3f73d8f612d2aae4f84559738bdfa19f191edbf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d6f72616e67652e7376673f7374796c653d666c61742d737175617265)](LICENSE)

I found fixtures really tiring and cumbersome to maintain with Yii2 models. So, I decided to write this extension that basically wraps FactoryMuffin and attaches factory definitions to any model that you want to seed in the database. I found it extremely helpful for seeding databases dynamically which is especially useful when writing tests. If you've used FactoryGirl or FactoryMuffin before, this is the same concept tailored for the Yii2 framework. I tried to keep things as tidy as possible. Contributions are more than welcome!

Installing
----------

[](#installing)

[PHP](https://php.net) 5.5+ and [Composer](https://getcomposer.org) are required.

In your composer.json, simply add `"saada/yii2-factory-muffin": "dev-master"` to your `"require"` section:

```
{
    "require": {
        "saada/yii2-factory-muffin": "@dev",
        "league/factory-muffin-faker": "@dev"
    }
}
```

Example Usage
-------------

[](#example-usage)

```
