Prefills factories with faker method suggestions to increase productivity
Switch branches/tags
Nothing to show
Clone or download
Latest commit 362e354 Dec 4, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src tidy up guessing types Dec 4, 2018
tests
.gitignore first commit Nov 23, 2018
.styleci.yml first commit Nov 23, 2018
.travis.yml first commit Nov 23, 2018
CHANGELOG.md add CHANGELOG Nov 23, 2018
CONTRIBUTING.md first commit Nov 23, 2018
LICENSE.md first commit Nov 23, 2018
composer.json first commit Nov 23, 2018
composer.lock first commit Nov 23, 2018
phpunit.xml first commit Nov 23, 2018
readme.md add --dev flag to composer require Nov 23, 2018

readme.md

laravel-factory-prefill

Software License Total Downloads

Factories are a great concept and I really love to use them for testing purposes, but it sucks to write every needed column name and associated faker methods by hand. This package aims to make the process less painfull by providing a command to prefill your factories!

After creating a factory with the artisan cli you end up having something like this:

<?php

use Faker\Generator as Faker;

$factory->define(Model::class, function (Faker $faker) {
    return [
        //
    ];
});

With laravel-factory-prefill you can just skip the previous command call and instead execute php artisan factory:prefill Habit.

factory:prefill

Install

composer require naoray/laravel-factory-prefill --dev

Usage

After running php artisan migrate you are good to go. If you want the factory:prefill command to notice the model relations, you should implement the methods first!

php artisan factory:prefill model_name

Testing

Was not added yet.

Run the tests with:

vendor/bin/phpunit

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security-related issues, please email krishan.koenig@googlemail.com instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.