PHPackages                             oluokunkabiru/auto-seeder - 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. oluokunkabiru/auto-seeder

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

oluokunkabiru/auto-seeder
=========================

Intelligent automated PHP database seeder for Laravel that introspects schema architectures to instantly populate precise Fake data natively adhering to Types, ENUM fields, and Foreign Key Constraints.

v4.0.1(3mo ago)014↓80%MITPHPPHP &gt;=8.0

Since Apr 3Pushed 3mo agoCompare

[ Source](https://github.com/oluokunkabiru/auto-seeder)[ Packagist](https://packagist.org/packages/oluokunkabiru/auto-seeder)[ Docs](https://github.com/oluokunkabiru/auto-seeder)[ RSS](/packages/oluokunkabiru-auto-seeder/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (8)Used By (0)

Auto-Seeder
===========

[](#auto-seeder)

A zero-config PHP package that connects to your database via an Eloquent model (or a raw PDO connection), reads all column definitions, and inserts randomly-generated, realistic data — no seeders to write by hand.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.0
- fakerphp/faker ^1.23

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

[](#installation)

```
composer require oluokunkabiru/auto-seeder
```

Artisan Command
---------------

[](#artisan-command)

After installation the `seed:auto` command is automatically available:

```
# Seed 1 row (default)
php artisan seed:auto User

# Seed N rows
php artisan seed:auto User 50

# Full FQCN
php artisan seed:auto "App\Models\Order" 100

# Override email domain and phone country code at runtime
php artisan seed:auto User 50 --domain=acme.com --country-code=+234

# Skip specific columns
php artisan seed:auto User 50 --skip=api_token,stripe_id

# Use a different Faker locale
php artisan seed:auto User 50 --locale=fr_FR
```

Web Dashboard
-------------

[](#web-dashboard)

A self-contained browser UI is registered at `http://your-app.test/auto-seeder`.

**Features:**

- 🃏 **Model cards** — auto-discovered from `app/Models`, each with a row count input (default 1) and a **Seed** button
- ⚙️ **Settings tab** — configure locale, default count, email domain, phone country code — saved to `.env`
- 🌙 **Dark / Light mode** toggle (persisted in `localStorage`)
- ✅ **Toast notifications** on success or error

**Publish the views** to customise the dashboard:

```
php artisan vendor:publish --tag=auto-seeder-views
```

**Disable the dashboard** (e.g. in production):

```
AUTO_SEEDER_DASHBOARD=false
```

**Restrict to authenticated users:**

```
// config/auto-seeder.php
'route_middleware' => ['web', 'auth'],
```

The ServiceProvider is automatically registered via package auto-discovery.

Publish the config file to customise generation defaults:

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

This creates `config/auto-seeder.php` in your Laravel project:

```
return [

    // Faker locale (see https://fakerphp.org/locales/)
    'locale' => env('AUTO_SEEDER_LOCALE', 'en_US'),

    // Default row count when seed() is called with no argument
    'default_count' => env('AUTO_SEEDER_DEFAULT_COUNT', 1),

    // Per-column format options (exact or partial name match)
    'columns' => [
        'email'  => ['domain'       => env('AUTO_SEEDER_EMAIL_DOMAIN', null)],   // e.g. 'koadit.com'
        'phone'  => ['country_code' => env('AUTO_SEEDER_PHONE_COUNTRY_CODE', null)],
        // e.g. '+234'
        // 08130584550
        'mobile' => ['country_code' => env('AUTO_SEEDER_PHONE_COUNTRY_CODE', null)],
    ],

    // Extra columns to always skip (on top of id, timestamps, etc.)
    'skip' => [
        // 'two_factor_secret',
    ],

    // Override how specific DB types are treated (future use)
    'types' => [],
];
```

You can also use `.env` shortcuts without touching the config file:

```
AUTO_SEEDER_LOCALE=fr_FR
AUTO_SEEDER_DEFAULT_COUNT=10
AUTO_SEEDER_EMAIL_DOMAIN=koadit.com
AUTO_SEEDER_PHONE_COUNTRY_CODE=+234
```

Usage
-----

[](#usage)

### Laravel / Eloquent

[](#laravel--eloquent)

```
use Oluokunkabiru\AutoSeeder\AutoSeeder;
use App\Models\User;

// Seed 1 row (default)
AutoSeeder::fromModel(User::class)->seed();

// Seed 50 rows
AutoSeeder::fromModel(User::class)->seed(50);

// Shorthand — pass count as second argument to fromModel()
AutoSeeder::fromModel(User::class, 50);

// Skip extra columns
AutoSeeder::fromModel(User::class)
    ->skip(['api_token', 'two_factor_secret'])
    ->seed(100);

// Custom email domain + phone country code
AutoSeeder::fromModel(User::class)
    ->configure([
        'email' => ['domain' => 'acme.com'],    // → someone@acme.com
        'phone' => ['country_code' => '+234'],   // → +234XXXXXXXXXX
    ])
    ->seed(50);

// Multiple phone columns with different country codes
AutoSeeder::fromModel(User::class)
    ->configure([
        'email'         => ['domain' => 'company.io'],
        'phone'         => ['country_code' => '+1'],
        'mobile_number' => ['country_code' => '+44'],
    ])
    ->seed(20);
```

Inside `DatabaseSeeder.php`:

```
public function run(): void
{
    AutoSeeder::fromModel(\App\Models\User::class)->seed(20);
    AutoSeeder::fromModel(\App\Models\Product::class)->seed(100);
}
```

### Standalone PHP (raw PDO)

[](#standalone-php-raw-pdo)

```
use Oluokunkabiru\AutoSeeder\AutoSeeder;

$pdo = new PDO('mysql:host=localhost;dbname=mydb', 'root', '');

// Seed 10 rows into the "orders" table
AutoSeeder::fromPdo($pdo)->seed(10, 'orders');

// Seed 1 row (default)
AutoSeeder::fromPdo($pdo)->seed(table: 'orders');
```

How It Works
------------

[](#how-it-works)

1. **Inspect** — Reads every column from the table using `DESCRIBE` (MySQL), `PRAGMA table_info` (SQLite), or `information_schema` (PostgreSQL).
2. **Generate** — Maps each column to a Faker method using:
    - **Name heuristics** — e.g. a column named `email` → `$faker->safeEmail()`, `phone` → `$faker->phoneNumber()`.
    - **Type mapping** — e.g. `decimal` → `$faker->randomFloat(2)`, `datetime` → `$faker->dateTime()`, `enum('a','b')` → random pick.
3. **Insert** — Bulk-inserts all rows via a prepared PDO statement.

Skipped Columns (automatic)
---------------------------

[](#skipped-columns-automatic)

The following columns are **never seeded** (auto-detected):

ColumnReason`id`Auto-increment PK`created_at` / `updated_at`Managed by ORM`deleted_at`Soft delete`remember_token`, `email_verified_at`Framework internalsSupported Column Types
----------------------

[](#supported-column-types)

DB TypeGenerated Value`varchar`, `char`Random word/sentence`text`, `longtext`Paragraph`int`, `bigint`, etc.Random number`tinyint(1)` / `boolean``true` / `false``decimal`, `float`, `double`Random float`date`Random date`datetime`, `timestamp`Random datetime`enum`Random pick from enum values`json``{"key": "...", "value": "..."}``uuid`UUID v4Supported Databases
-------------------

[](#supported-databases)

- ✅ MySQL / MariaDB
- ✅ SQLite
- ✅ PostgreSQL

License
-------

[](#license)

MIT © OLUOKUN KABIRU ADESINA

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance82

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

7

Last Release

90d ago

Major Versions

v1.0.2 → v2.0.12026-04-03

v2.0.1 → v3.0.22026-04-03

v3.0.3 → v4.0.12026-04-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/94fd074663fdc66b70cd016c3ace6abf367180c148532aa142cc4359543ae753?d=identicon)[devvboy](/maintainers/devvboy)

---

Top Contributors

[![oluokunkabiru](https://avatars.githubusercontent.com/u/47401341?v=4)](https://github.com/oluokunkabiru "oluokunkabiru (26 commits)")

---

Tags

testinglaravelfakerdatabaseseederauto-seed

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/oluokunkabiru-auto-seeder/health.svg)

```
[![Health](https://phpackages.com/badges/oluokunkabiru-auto-seeder/health.svg)](https://phpackages.com/packages/oluokunkabiru-auto-seeder)
```

###  Alternatives

[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k42.5M40.2k](/packages/orchestra-testbench)[orchestra/workbench

Workbench Companion for Laravel Packages Development

8320.3M73](/packages/orchestra-workbench)[code-distortion/adapt

A Laravel package that builds databases for your tests, improving their speed.

2838.1k](/packages/code-distortion-adapt)[sofa/eloquent-testsuite

Helpers for fast and reliable UNIT tests for your Eloquent Models with PHPUnit

10107.6k](/packages/sofa-eloquent-testsuite)

PHPackages © 2026

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