PHPackages                             laravel-shift/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. [Testing &amp; Quality](/categories/testing)
4. /
5. laravel-shift/factory-generator

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

laravel-shift/factory-generator
===============================

Generate factories from existing models

v2.2(1y ago)49697.9k—7.4%21[2 PRs](https://github.com/laravel-shift/factory-generator/pulls)MITPHPPHP ^8.1

Since Mar 9Pushed 2mo ago4 watchersCompare

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

READMEChangelogDependencies (4)Versions (6)Used By (0)

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

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

This package generates model factories from existing models using the new [class-based factories](https://laravel.com/docs/8.x/database-testing#writing-factories) introduced in Laravel 8.

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

[](#installation)

You may install this package via composer by running:

```
composer require --dev laravel-shift/factory-generator
```

The package will automatically register itself using Laravel's package discovery.

Usage
-----

[](#usage)

This package adds an artisan command for generating model factories.

Without any arguments, this command will generate model factories for all existing models within your Laravel application:

```
php artisan generate:factory
```

Similar to Laravel, this will search for models within the `app/Models` folder, or if that folder does not exist, within the `app` folder.

To generate factories for models within a different folder, you may pass the `--path` option (or `-p`).

```
php artisan generate:factory --path=some/Other/Path
```

To generate a factory for a single model, you may pass the model name:

```
php artisan generate:factory User
```

By default *nullable* columns are not included in the factory definition. If you want to include *nullable* columns you may set the `--include-nullable` option (or `-i`).

```
php artisan generate:factory -i User
```

Attribution
-----------

[](#attribution)

This package was original forked from [Naoray/laravel-factory-prefill](https://github.com/Naoray/laravel-factory-prefill) by [Krishan König](https://github.com/Naoray).

It has diverged to support the latest version of Laravel and to power part of the automation by the [Tests Generator](https://laravelshift.com/laravel-test-generator).

Contributing
------------

[](#contributing)

Contributions should be submitted to the `master` branch. Any submissions should be complete with tests and adhere to the [Laravel code style](https://www.php-fig.org/psr/psr-2/). You may also contribute by [opening an issue](https://github.com/laravel-shift/factory-generator/issues).

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance67

Regular maintenance activity

Popularity52

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~248 days

Total

4

Last Release

419d ago

Major Versions

v1.0 → v2.02024-06-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/92a6bfc994b500ee991e6a7c581fb07af26b68b85821ff354bed0ac786fc9211?d=identicon)[jasonmccreary](/maintainers/jasonmccreary)

---

Top Contributors

[![jasonmccreary](https://avatars.githubusercontent.com/u/161071?v=4)](https://github.com/jasonmccreary "jasonmccreary (23 commits)")[![Naoray](https://avatars.githubusercontent.com/u/10154100?v=4)](https://github.com/Naoray "Naoray (3 commits)")[![mortenscheel](https://avatars.githubusercontent.com/u/6514342?v=4)](https://github.com/mortenscheel "mortenscheel (3 commits)")[![nuernbergerA](https://avatars.githubusercontent.com/u/13331388?v=4)](https://github.com/nuernbergerA "nuernbergerA (2 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![nexxai](https://avatars.githubusercontent.com/u/4316564?v=4)](https://github.com/nexxai "nexxai (1 commits)")[![acoustep](https://avatars.githubusercontent.com/u/2813287?v=4)](https://github.com/acoustep "acoustep (1 commits)")[![tobycurl](https://avatars.githubusercontent.com/u/1096502?v=4)](https://github.com/tobycurl "tobycurl (1 commits)")[![chriischambers](https://avatars.githubusercontent.com/u/65727432?v=4)](https://github.com/chriischambers "chriischambers (1 commits)")[![daryledesilva](https://avatars.githubusercontent.com/u/4393436?v=4)](https://github.com/daryledesilva "daryledesilva (1 commits)")[![klaasnicolaas](https://avatars.githubusercontent.com/u/20448157?v=4)](https://github.com/klaasnicolaas "klaasnicolaas (1 commits)")

---

Tags

testinglaravelfactorymodel

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/laravel-shift-factory-generator/health.svg)

```
[![Health](https://phpackages.com/badges/laravel-shift-factory-generator/health.svg)](https://phpackages.com/packages/laravel-shift-factory-generator)
```

###  Alternatives

[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[timacdonald/log-fake

A drop in fake logger for testing with the Laravel framework.

4235.9M56](/packages/timacdonald-log-fake)[orchestra/workbench

Workbench Companion for Laravel Packages Development

8217.0M43](/packages/orchestra-workbench)[mpociot/laravel-test-factory-helper

Generate Laravel test factories from your existing models

933635.2k2](/packages/mpociot-laravel-test-factory-helper)[laracasts/testdummy

Easy test stubs

4671.4M36](/packages/laracasts-testdummy)[davestewart/sketchpad

An innovative front-end environment for interactive Laravel development

29512.9k1](/packages/davestewart-sketchpad)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
