Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
🏭This package lets you create factory classes for your Laravel project.
| Date | Stars |
|---|---|
| 2026-07-24 | 381 |
| 2026-07-25 | 381 |
| 2026-07-28 | 381 |
| 2026-07-30 | 381 |
| 2026-08-06 | 381 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
# Laravel Factories Reloaded 🏭
[](https://packagist.org/packages/christophrumpel/laravel-factories-reloaded)
[](https://packagist.org/packages/christophrumpel/laravel-factories-reloaded)
[](LICENSE.md)
This package generates `class-based` model factories, which you can use instead of the ones provided by Laravel.

## Laravel 8 Support
The new version v3 now supports Laravel 8 and PHP 8+. Since L8 changed their own implementation of factories a lot, this new v2 version ONLY works with Laravel 8.
If you are not using L8 yet, use the latest 1.* version of this package, if you need PHP 7 support, use the latest 2.* version.
## Benefits
* use the **features you already love from Laravel factories** (`create`, `make`, `times`, `states`)
* **automatically create** new class factories for specific or `All` your models
* **automatically import** defined `default data` and `states` from your Laravel factories
* and many more...
📺 I've recorded some [videos](https://www.youtube.com/playlist?list=PLk9WlAgeZoTep60sHw8tMhXVpLuH3DV0Z) to give you an overview of the features.
> :warning: **Note**: Interested in WHY you need class-based factories? Read [here](#why-class-based-factories).
## Installation
You can install the package via composer:
```bash
composer require --dev christophrumpel/laravel-factories-reloaded
```
To publish the config file run:
```bash
php artisan vendor:publish --provider="Christophrumpel\LaravelFactoriesReloaded\LaravelFactoriesReloadedServiceProvider"
```
It will provide the package's config file where you can define `multiple paths of your models`, the `path of the newly generated factories`, the `namespace of your old Laravel factories`, as well as where your `old Laravel factories` are located.
## Configuration
### Laravel Factories Namespace
Factories are namespaced since Laravel 8, and the default factories namespace is `Database\Factories`. If your laravel factories namespace is `Database\Factories\ClassFactories`, you can customize it at the config file as below:
```php
'vanilla_factories_namespace' => 'Database\Factories\ClassFactories',
```
It will resolve your old laravel factory class as `Database\Factories\ClassFactories\UserFactory`, instead of `Database\Factories\UserFactory`.
## Usage
### Generate Factories
First, you need to create a new factory class for one of your models. This is done via a newly provided command called `make:factory-reloaded`.
```bash
php artisan make:factory-reloaded
```
You can pick one of the found models or create factories for `all` of them.
#### Command Options
If you want to define options through the command itself, you can do that as well:
```bash
php artisan make:factory-reloaded --models_path="app/Models" --factories_path="tests/ClassFactories" --factories_namespace="Tests\ClassFactories"
```
Currently, you can only define one location for your models this way.
### Define Default Model Data
Similar to Laravel factories, you can define default data for your model instances. Inside your new factories, there is a `getDefaults` method defined for that. The `Faker` helper to create dummy data is available as well.
```php
public function getDefaults(Faker $faker): array
{
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',
'remember_token' => Str::random(10),
'active' => false,
];
}
```
### Use New Factories
Let's say you have createExcerpt of 10,652 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:ebdd1b0d00cbe563, topic:testing