PHPackages                             evotodi/seed-bundle - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. evotodi/seed-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

evotodi/seed-bundle
===================

Seeder for symfony 6/7

7.3(10mo ago)1365.3k↓36.7%5MITPHPPHP ^8

Since Mar 11Pushed 10mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (11)Versions (14)Used By (0)

[![Symfony](https://camo.githubusercontent.com/75640a8af2eb1f88bec55acdbfd1052c4a4734b55418179bbbc411a4bd0374ab/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73796d666f6e792d2532333030303030302e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d73796d666f6e79266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/75640a8af2eb1f88bec55acdbfd1052c4a4734b55418179bbbc411a4bd0374ab/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73796d666f6e792d2532333030303030302e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d73796d666f6e79266c6f676f436f6c6f723d7768697465)[![PhpStorm](https://camo.githubusercontent.com/0a232f095a061b7f45c7d09970563fd5646f07c9f5f9d65d7076871c4ee8a367/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70687073746f726d2d3134333f7374796c653d666f722d7468652d6261646765266c6f676f3d70687073746f726d266c6f676f436f6c6f723d626c61636b26636f6c6f723d626c61636b266c6162656c436f6c6f723d6461726b6f7263686964)](https://camo.githubusercontent.com/0a232f095a061b7f45c7d09970563fd5646f07c9f5f9d65d7076871c4ee8a367/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70687073746f726d2d3134333f7374796c653d666f722d7468652d6261646765266c6f676f3d70687073746f726d266c6f676f436f6c6f723d626c61636b26636f6c6f723d626c61636b266c6162656c436f6c6f723d6461726b6f7263686964)

[![](https://camo.githubusercontent.com/69e4b084933e21b1e96a044f02d1d91eea7dd0e6bcf7c203e550e45a767bc072/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76362e302d427265616b696e672532304368616e67652d726564)](https://camo.githubusercontent.com/69e4b084933e21b1e96a044f02d1d91eea7dd0e6bcf7c203e550e45a767bc072/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76362e302d427265616b696e672532304368616e67652d726564)

Symfony/Doctrine Seed Bundle
============================

[](#symfonydoctrine-seed-bundle)

Used to load/unload seed data from a doctrine database or anything that needs seeded.

Example would be to load a table with a list of states and abbreviations, or populate the users table with initial admin user(s). Unlike the [DoctrineFixturesBundle](https://github.com/doctrine/DoctrineFixturesBundle) which is mainly for development this bundle is for seeding a database before the initial push to production.

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

[](#installation)

Install the package with:

```
composer require evotodi/seed-bundle
```

(Optional) Load seeds as services `config/services.yaml`
In Symfony default services.yaml classes in src/ are loaded as services, so creating a folder src/DataSeeds/ will load the seeds as services.

```
services:
    Evotodi\SeedBundle\DataSeeds\:
        resource: '../DataSeeds/*'
```

Building a seed to populate a database
--------------------------------------

[](#building-a-seed-to-populate-a-database)

The `Seed` class is a `Command` and :

- Must extend `Evotodi\SeedBundle\Command\Seed`
- Must return the seed name from the static `seedName` method
- Seed naming must follow the colon seperated naming convention for symfony console commands.

```
