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

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

talyssonoc/phactory-laravel
===========================

Use Phactory inside Laravel

v0.1(10y ago)216MITPHP

Since Jun 10Pushed 10y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Phactory Laravel
================

[](#phactory-laravel)

With Phactory Laravel you'll be able to use [Phactory](http://phactory.org/) with Laravel 5.

If you don't know what `Phactory` is:

```
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 in your PHP code.

```

`Phactory Laravel` will access the database based on your `Laravel` config, simple as that.

Be aware that you must [specify a testing database](https://laracasts.com/discuss/channels/testing/how-to-specify-a-testing-database-in-laravel-5), otherwise `Phactory Laravel` will insert data in your development database.

Installation
------------

[](#installation)

First you need to add this to your `composer.json` requires:

```
	"talyssonoc/phactory-laravel": "dev-master"
```

Then set the `minimum-stability` of your dependencies to `dev`, adding this to your `composer.json`:

```
	"minimum-stability": "dev"
```

Then run:

```
	$ composer install
```

After that you should add this to your service providers (at `config/app.php`):

```
	'PhactoryLaravel\PhactoryServiceProvider'
```

And that to your aliases (at the same file):

```
	'Phactory'	=> 'PhactoryLaravel\\Phactory'
```

After that, `Phactory` facade will be available for you to use.

Creating a factory
------------------

[](#creating-a-factory)

Yours factories must be inside the folder `app/Factories`, and you should use the API provided by `Phactory`. The content of each file must be something like this:

```
