PHPackages                             nekoos/laravel-seed-drain - 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. nekoos/laravel-seed-drain

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

nekoos/laravel-seed-drain
=========================

Incremental seed execution aligned with migrations, without extra schema.

v1.0.0(4mo ago)0321↓35.7%MITPHPPHP ^8.2CI passing

Since Feb 14Pushed 4mo agoCompare

[ Source](https://github.com/NekoOs/laravel-seed-drain)[ Packagist](https://packagist.org/packages/nekoos/laravel-seed-drain)[ RSS](/packages/nekoos-laravel-seed-drain/feed)WikiDiscussions main Synced yesterday

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

Laravel Seed Drain
==================

[](#laravel-seed-drain)

[![CI Checks](https://github.com/nekoos/laravel-seed-drain/actions/workflows/ci.checks.ci.enforce.yml/badge.svg)](https://github.com/nekoos/laravel-seed-drain/actions/workflows/ci.checks.ci.enforce.yml)

**Languages:** English | [Español](README.es.md)

Incremental seed execution aligned with migrations.

`artisan migrate --seed` is useful for initial bootstrap, but it falls short in continuous automation workflows:

- Migrations have native incremental control.
- Seeders do not provide that same control by default.
- In repeated deployments, `db:seed` can be hard to scope to the right moment.

`laravel-seed-drain` simplifies this with an explicit temporary seeder queue. By default, it does not require additional database tables. Optionally, it can persist queue state in a dedicated database table.

What Problem It Solves
----------------------

[](#what-problem-it-solves)

- Execute only relevant seeders after migrations.
- Avoid introducing extra tracking schema for seeder execution.
- Keep CI/CD workflows simple for development and production.
- Optionally separate seeders by logical queues (`default`, `core`, `demo`).

Core Idea
---------

[](#core-idea)

Register seeders during migration `up()`.

Then execute a dedicated command to drain them.

```
php artisan migrate --force
php artisan seed:drain --force
```

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

[](#installation)

Install the package via Composer:

```
composer require nekoos/laravel-seed-drain:^1.0
```

Setup
-----

[](#setup)

Publish package files when you need to customize them:

```
# Publish configuration
php artisan vendor:publish --tag=seed-drain-config

# Publish package migrations (including seed_drain_queues)
php artisan vendor:publish --tag=seed-drain-migrations
```

Run migrations:

```
php artisan migrate
```

For contribution and local development guidelines, see `CONTRIBUTING.md`.

Proposed Public API
-------------------

[](#proposed-public-api)

Default usage (`default` queue):

```
use NekoOs\LaravelSeedDrain\Support\SeedQueue;

SeedQueue::add(
    \Database\Seeders\UsersSeeder::class,
    \Database\Seeders\SessionSeeder::class,
);
```

Explicit queues (fluent API):

```
use NekoOs\LaravelSeedDrain\Support\SeedQueue;

SeedQueue::on('core')->add(
    \Database\Seeders\PermissionsSeeder::class,
    \Database\Seeders\StatusesSeeder::class,
);

SeedQueue::on('demo')->add(
    \Database\Seeders\DemoUsersSeeder::class,
);
```

By default, duplicate seeders are kept in the queue and executed in order.

Migration Example
-----------------

[](#migration-example)

```
