PHPackages                             airondev/laravel-seeder-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. [Database &amp; ORM](/categories/database)
4. /
5. airondev/laravel-seeder-generator

ActiveLibrary[Database &amp; ORM](/categories/database)

airondev/laravel-seeder-generator
=================================

A Laravel package to generate seeders for each database table.

v1.0.1(1y ago)17731MITPHPPHP ^7.4|^8.0

Since Jun 13Pushed 1y ago2 watchersCompare

[ Source](https://github.com/AironDev/laravel-seeder-generator)[ Packagist](https://packagist.org/packages/airondev/laravel-seeder-generator)[ RSS](/packages/airondev-laravel-seeder-generator/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Seeder Generator
========================

[](#laravel-seeder-generator)

[![Latest Stable Version](https://camo.githubusercontent.com/0ada5115c55c7f7d9658834c3fc00bf8308db3d6f1b5a491359379966d34bff5/68747470733a2f2f706f7365722e707567782e6f72672f6169726f6e6465762f6c61726176656c2d7365656465722d67656e657261746f722f762f737461626c65)](https://packagist.org/packages/airondev/laravel-seeder-generator)[![Total Downloads](https://camo.githubusercontent.com/76fa9c76cea38c6751ebaf62b40372b6b8714cc7555dcb8ba3d99d672d2cd38c/68747470733a2f2f706f7365722e707567782e6f72672f6169726f6e6465762f6c61726176656c2d7365656465722d67656e657261746f722f646f776e6c6f616473)](https://packagist.org/packages/airondev/laravel-seeder-generator)[![License](https://camo.githubusercontent.com/3c5ee93ac295256be95a3bc70481f631a0fa261704dd1470e341d3fd28b4b141/68747470733a2f2f706f7365722e707567782e6f72672f6169726f6e6465762f6c61726176656c2d7365656465722d67656e657261746f722f6c6963656e7365)](https://packagist.org/packages/airondev/laravel-seeder-generator)

Laravel Seeder Generator is a package that automatically generates seeders for each table in your database. It simplifies the process of creating seeders, allowing you to focus on other important tasks in your Laravel application.

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

[](#installation)

You can install the package via Composer:

```
composer require airondev/laravel-seeder-generator
```

### Step 1: Register the Service Provider

[](#step-1-register-the-service-provider)

If you are using Laravel 5.5 or later, the package will be auto-discovered. For earlier versions of Laravel, add the service provider to the `providers` array in `config/app.php`:

```
'providers' => [
    // Other Service Providers

    Airondev\SeederGenerator\SeederGeneratorServiceProvider::class,
],
```

### Step 2: Publish Configuration File (Optional)

[](#step-2-publish-configuration-file-optional)

You can publish the configuration file to customize the seeder path. Run the following command:

```
    php artisan vendor:publish --tag=config
```

Usage
-----

[](#usage)

### Configuration

[](#configuration)

By default, seeders are generated in the database/seeders directory. You can customize this path by modifying the seeder-generator.php configuration file in your Laravel application's config directory

```
    // config/seeder-generator.php

    return [
        'path' => env('SEEDER_PATH', 'database/seeders'),
    ];
```

### Generate Seeders

[](#generate-seeders)

To generate seeders for each table in your database, run the following command:

```
php artisan make:seeders
```

This command will create a seeder file for each table in the `database/seeders` directory.

### Customize Stub File (Optional)

[](#customize-stub-file-optional)

If you want to customize the seeder stub file, you can publish it to your application and make your changes:

```
php artisan vendor:publish --tag=stubs
```

The stub file will be published to the `stubs` directory in the root of your application. You can edit it to fit your needs.

Example
-------

[](#example)

After running the `php artisan make:seeders` command, you will see seeder files generated in the `database/seeders` directory:

```
