codesvault/wp-seeder

Database seeder for WordPress

Installs: 885

Dependents: 0

Suggesters: 0

Security: 0

Stars: 12

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/codesvault/wp-seeder

1.2.0 2026-01-04 12:23 UTC

This package is auto-updated.

Last update: 2026-01-06 09:02:21 UTC


README

Add demo data in the Database from terminal.

Installation

It is required to install it using composer composer install codesvault/wp-seeder.
It supports PHP >= 7.4




Uses

To create a new seeder, run below command in the terminal and provide necessary inputs.

./vendor/bin/wpseed new

It will generate /seeders directory in <plugin_root>/database directory. Don't move this directory to other location, it must be there. In the /database/seeders folder you will have your seeder which was automatically generated, the file name will be same as the class name that you had given input.


Now change the $table property according to your table name where you want to store data. $row property is for number of rows you want to generate in the table. For generating demo data WP Seeder has build-in support of FakerPHP.

Here is an example seeder class:

class YourClassName extends WPSeeder
{
    public $table = "cv_users";    // db table name without prefix, default is posts.
    public $row = 5;      // number of db table row will create, default is 1.

    public function run()
    {
        // add data that need to be inserted in database.
        // array key is the column name, value is data that will be stored.
        return array(
            'name' => $this->faker()->unique()->name(),
            'email' => $this->faker()->unique()->email(),
            'password' => $this->faker()->unique()->password()
        );
    }
}

If you want to create more seeders for different tables then just repeate the above process. Now just run below command in the terminal from plugin's root directory and data will be stored in the database.

`./vendor/bin/wpseed store`

.