PHPackages                             rymanalu/factory-generator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. rymanalu/factory-generator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rymanalu/factory-generator
==========================

Laravel 5 Model Factory Generator.

v1.0.2(9y ago)178.0k4[3 issues](https://github.com/rymanalu/factory-generator/issues)MITPHPPHP &gt;=5.5.9

Since Mar 24Pushed 8y ago1 watchersCompare

[ Source](https://github.com/rymanalu/factory-generator)[ Packagist](https://packagist.org/packages/rymanalu/factory-generator)[ Docs](https://github.com/rymanalu/factory-generator)[ RSS](/packages/rymanalu-factory-generator/feed)WikiDiscussions 1.0 Synced 4w ago

READMEChangelog (4)Dependencies (2)Versions (6)Used By (0)

Laravel 5 Model Factory Generator
=================================

[](#laravel-5-model-factory-generator)

This package offers a lazy way to create a new model factory files, since Laravel (&lt; 5.5) have no Artisan command to generate it.

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

[](#installation)

First, install this package via the Composer package manager:

```
composer require rymanalu/factory-generator

```

Next, you should add the `FactoryGeneratorServiceProvider` to the `providers` array of your `config/app.php` configuration file:

```
Rymanalu\FactoryGenerator\FactoryGeneratorServiceProvider::class,
```

Now, you should be able to generate a new model factory file by executing `php artisan make:factory` command.

Usage
-----

[](#usage)

`php artisan make:factory` accept one argument: the model class name with the namespace. Make sure the model is already exists before executing this command.

Example:

```
php artisan make:factory "App\Post"

```

The command will generate a file named `PostFactory.php` in `/path/to/your-laravel-project/database/factories` directory:

```
