strawberrydev / wimd
Where Is My Data - A Laravel seeder monitoring package
Requires
- php: ^8.1|^8.2|^8.3
- laravel/framework: ^9.0|^10.0|^11.0|^12.0
This package is auto-updated.
Last update: 2025-06-15 15:45:01 UTC
README
Introduction
Have you ever wondered where your data is while seeding? Me too. That's why there's WIMD (Where Is My Data), a Laravel package that enhances your database seeding process with monitoring. It provides real-time tracking of seeding performance, detailed metrics, and insightful reporting to help you optimize your database seeding operations.
Warning
This is the first release and not a stable version. It is meant to showcase the current state of the project and its progress. Updates will be made.
Some features don't work yet and will be properly implemented in future updates.
Requirements
- PHP 8.1+
- Laravel 9.0+
Installation
You can install the package via composer:
composer require strawberrydev/wimd
Or for alpha version
composer require strawberrydev/wimd:"dev-main"
Configuration
Publish the configuration file using:
php artisan vendor:publish --tag=wimd-config
This will create a config/wimd.php
file where you can customize the package behavior.
Usage
DatabaseSeeder
<?php namespace Database\Seeders; use Wimd\Template\WimdDatabaseSeeder; class DatabaseSeeder extends WimdDatabaseSeeder { public function run() { $this->call([ UserSeeder::class, CategoriesSeeder::class, ProductsSeeder::class, TagsSeeder::class, ProductTagSeeder::class, UserDetailsSeeder::class, ReviewsSeeder::class, ]); // Optional $this->displayWimdReport(); } }
Use this line if you want to manually display the report (not shown by default unless using the specific command):
$this->displayWimdReport();
Seeder
Extend Wimd\Template\WimdSeeder
instead of Laravel's Seeder
:
<?php namespace Database\Seeders; use App\Models\User; use Illuminate\Support\Facades\Hash; use Wimd\Template\WimdSeeder; class UserSeeder extends WimdSeeder { protected function prepare(): void { $this->totalItems = 1000; $this->fullItems = 1000000; $this->lightItems = 250; $this->batchSize = 77; } protected function seed(): void { $admin = [ 'name' => 'Admin User', 'email' => 'admin@example.com', 'password' => Hash::make('password'), 'created_at' => now(), 'updated_at' => now(), ]; $this->insertItem('users', $admin); $this->createWithFactory(User::class, $this->totalItems - 1); } }
Advanced Usage
Using the Built-in Batch Methods
batchInsert()
$this->batchInsert('users', $usersArray, $batchSize);
insertItem() and insertItemAndGetId()
$this->insertItem('users', $userData);
createWithFactory()
$this->createWithFactory(User::class, 50);
License
The MIT License (MIT). Please see License File for more information.