Code review at scale is broken. Here’s how Augment Code is fixing it.

Iseed

orangehill/iseed image

Iseed stats

Downloads
5.1M
Stars
2,635
Open Issues
75
Forks
367

View on GitHub →

Generate a new Laravel database seed file based on data from the existing database table.

Inverse Seed Generator (iSeed)

The Inverse Seed Generator (iSeed) is a Laravel package designed to efficiently generate seed files from existing database tables. This tool is ideal for developers who need to replicate database contents in a structured and reusable way, particularly useful in testing and staging environments.

Key Features

  • Generate Seed Files: Automatically creates seed files based on existing database tables.
  • Custom Class Names: Supports prefixes and suffixes for Seeder class names to avoid overwriting existing seeds.
  • Flexible Usage: Allows specification of multiple tables, custom DB connections, chunk sizes, max rows, and more.
  • Artisan Support: Fully integrated with Laravel's Artisan command-line tool, enhancing its functionality.
  • Event Hooks: Provides options to execute Laravel events before and after seed generation.

Installation and Setup

  1. Install via Composer:

    composer require orangehill/iseed

    For Laravel 5.3.7 and below or Laravel 4, specify the version:

    composer require orangehill/iseed:2.2 # For Laravel 5.3.7 and below
    composer require orangehill/iseed:1.1 # For Laravel 4
  2. Register Service Provider (For Laravel 5.4 and below as newer versions support auto-discovery):

    Orangehill\Iseed\IseedServiceProvider::class,

Usage

To generate a seed file for a database table:

php artisan iseed my_table

This command will create a new seed file in the /database/seeds directory with the SQL data from my_table.

Advanced Options

  • Multiple Tables: php artisan iseed table1,table2
  • Overwrite Existing Seeds: --force
  • Limit Rows: --max=10
  • Custom DB Connection: --database=custom_connection
  • Exclude Columns: --exclude=id,created_at

Practical Examples

Generate seeds with custom class names:

php artisan iseed users --classnameprefix=Custom

Exclude specific columns and limit the number of rows:

php artisan iseed users --exclude=email,created_at --max=50

Conclusion

iSeed is a powerful tool for Laravel developers, simplifying the process of generating seed files from existing databases, making it easier to manage and replicate database states across different environments. Whether you're working on a small project or a large enterprise application, iSeed offers the flexibility and efficiency needed for effective database management and testing.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Orangehill Iseed Related Articles

iSeed – Laravel Inverse Seed Generator image

iSeed – Laravel Inverse Seed Generator

Read article
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Cut PHP Code Review Time & Bugs into Half with CodeRabbit logo

Cut PHP Code Review Time & Bugs into Half with CodeRabbit

CodeRabbit is an AI-powered code review tool that specializes in PHP and Laravel, running PHPStan and offering automated PR analysis, security checks, and custom review features while remaining free for open-source projects.

Cut PHP Code Review Time & Bugs into Half with CodeRabbit
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec