PHPackages                             devian2011/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. [Database &amp; ORM](/categories/database)
4. /
5. devian2011/seeder

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

devian2011/seeder
=================

Database seeder for test and fake data. Also it works with predefined values

v0.0.4(4y ago)05MITPHPPHP &gt;=7.4

Since Apr 25Pushed 3y ago1 watchersCompare

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

READMEChangelogDependencies (7)Versions (6)Used By (0)

Database Seeder
===============

[](#database-seeder)

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

[](#installation)

```
composer require devian2011/seeder
```

Usage
-----

[](#usage)

### Simple usage

[](#simple-usage)

```
php ./vendor/bin/seeder.php seeder:fill-data --templates-dir=$(PWD)/examples --mode=predefined --params=$(PWD)/.env
```

ParamDefinitionIsRequiredtemplates-dirComma separated paths to directories which contains definitions for fixtures.trueparamsPath to env file. Also it supports get variables from $\_ENV Globalfalse### Advanced usage

[](#advanced-usage)

You can use seeder in your code for extend expressions, change output wrapper or add event listeners.

> Package uses [symfony/expression-language](https://symfony.com/doc/current/components/expression_language.html)
> For create your own functions you can write [extensions](https://symfony.com/doc/current/components/expression_language/extending.html)

```
$seeder = new \Devian2011\Seeder\Seeder(
    ['/path/to/notations/one', '/path/to/notations/two'], // Required param
    ['/path/to/env/file/.env', '/path/to/env/file/.env.local'] // optional param, it can be empty
);

$seeder->run(
    new \Devian2011\Seeder\Output\SymfonyConsoleOutput($output), // Output wrapper
    new class implements \Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface {
        public function getFunctions(){
            return [
                new \Symfony\Component\ExpressionLanguage\ExpressionFunction('plus', fn() -> return;, fn($ctx, $a , $b) -> return $a + $b)
            ]
        }
    }, // Expression Language extensions
    [
        new class implements \Devian2011\Seeder\Events\EventHandlerInterface {
            public function getActions() : array
            {
                return [\Devian2011\Seeder\SeederEvents::EVENT_SEEDER_CONFIG_LOADED]
                // List of events You cann see all events in \Devian2011\Seeder\SeederEvents
            }
            public function handle(\Devian2011\Seeder\Events\EventInterface $event){
                echo $event->getMessage(); // Event handler
            }
        }
    ] // Array of event handlers
);
```

Configuration
-------------

[](#configuration)

Better way for configure seeds it uses yaml notations

### Database connection configuration

[](#database-connection-configuration)

Seeder must contain databases section which is used for connect to databases and mark database connections.

```
databases:
  - code: seeder # Unique database code. It must use in tables definitions
    dsn: "env('MARIADB_DSN')" # PDO dsn
    user: "env('MARIADB_USER')" # Database user
    password: "env('MARIADB_PASSWORD')" # Database password
    options: # PDO options for database connect
```

### Table configuration

[](#table-configuration)

For create fake data this package uses - [fakerphp/faker](https://fakerphp.github.io/)

```
tables: # Required section name
  users: # Table code (it can be overwritten by another config)
    database: seeder # Database connection code.
    name: users # Table name
    rowQuantity: 5 # Fixtures row count
    primaryKey: id # Primary key
    columns: # Columns which should
      - name: id # Column name
        value: "auto_increment" # If field with 'auto_increment' value it will not been filled
      - name: login
        value: "faker.email()" # Expression language has faker. For call faker functions you must write faker.METHOD(...$params)
      - name: password
        value: "faker.word()"
      - name: balance
        value: "400"
      - name: balance_old
        value: "context.balance - 200" # Package has context support. Context works with current row. For get column value for this row you must write context.column_name
        depends: # If column value depends on another columns. You must write **depends** section which have a list if dependant columns
          - balance # This column depends on balance value
    relations: # If table has relation to another tables. You must set this block
      - name: role_id # Column name which should contain related value
        database: seeder # Database for relation table
        table: roles # Relation table
        column: id # Relation column
        type: manyToOne # Type of relation. Supports manyToOne and oneToOne relation

      - name: info_id
        database: seeder
        table: info
        column: id
        type: manyToOne
        fromDb: true # If column have relation with already loaded data. For it works, table with loaded data must have annotation
    fixed: # If we need to fill predefined data. Everything works like columns section
      - - name: id
          value: 1
        - name: login
          value: admin
        - name: password
          value: 123456
        - name: balance
          value: 400
        - name: balance_old
          value: "context.balance - 100"
          depends:
            - balance
      - - name: id
          value: 2
        - name: login
          value: manager
        - name: password
          value: 654321
        - name: balance
          value: 200
        - name: balance_old
          value: "context.balance - 100"
          depends:
            - balance
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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

4

Last Release

1484d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ab23f8bae69fbd9f56451ba8c62196f7d8779681cc715414a959f12519f4fa6d?d=identicon)[devian2011](/maintainers/devian2011)

---

Top Contributors

[![devian2011](https://avatars.githubusercontent.com/u/6470988?v=4)](https://github.com/devian2011 "devian2011 (9 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[kimai/kimai

Kimai - Time Tracking

4.6k7.4k1](/packages/kimai-kimai)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

53541.0k3](/packages/jolicode-castor)

PHPackages © 2026

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