DoctrineFixturesBundle
Symfony integration for Doctrine Data Fixtures to load sample and test data into your database
Repository Health
Technical Analysis
DoctrineFixturesBundle is the official Symfony bundle that integrates the Doctrine Data Fixtures library, letting you programmatically load sample data into any Doctrine ORM-backed database. You define plain PHP fixture classes that extend a base Fixture class and persist entities, then run a single console command to populate your schema.
It is the standard way Symfony applications seed development databases and prepare deterministic data for automated tests. The bundle handles fixture discovery, dependency ordering, groups, purging strategies, and entity-manager selection so teams can keep their seed data in version control alongside their code.
What You Get
- A
doctrine:fixtures:loadconsole command with append, dry-run, group, and entity-manager options - A base
Fixtureclass and interfaces (ORMFixtureInterface,FixtureGroupInterface,DependentFixtureInterface) for structuring seed data - Automatic fixture discovery and service registration through a Symfony compiler pass
- Pluggable purger factories to control how existing data is cleared before loading
- Support for multiple entity managers and shared object references across fixtures
Common Use Cases
- Seeding a local development database with realistic sample data
- Providing deterministic starting data for integration and functional tests
- Bootstrapping demo environments with predictable content
- Loading reference/lookup data such as roles, categories, or country lists
Under The Hood
Architecture - At boot, DoctrineFixturesBundle registers a Symfony extension (DoctrineFixturesExtension) and two compiler passes. FixturesCompilerPass collects every service tagged as a fixture and hands them to SymfonyFixturesLoader/FixturesProvider, while PurgerFactoryCompilerPass gathers pluggable purger factories. The LoadDataFixturesDoctrineCommand (doctrine:fixtures:load) then resolves the target entity manager from the ManagerRegistry, builds an ORMExecutor (or DryRunORMExecutor), applies the selected purger, and executes the ordered fixture set.
Tech Stack - Pure PHP 8.1+ targeting Symfony 6.4/7/8 and Doctrine ORM 2.14+/3, built on doctrine/data-fixtures, symfony/console, symfony/dependency-injection, and symfony/http-kernel. Development tooling includes PHPUnit, PHPStan, and the Doctrine Coding Standard (phpcs).
Code Quality - The codebase is small, strictly typed (declare(strict_types=1)), and enforced by PHPStan and phpcs configurations. It ships an integration test suite (tests/IntegrationTest.php with a dedicated IntegrationTestKernel) that boots a real kernel to exercise fixture loading and purging end to end.
API Design - The public surface is deliberately minimal: extend the base Fixture class, implement load(ObjectManager $manager), and optionally add DependentFixtureInterface or FixtureGroupInterface. Getting started requires almost no boilerplate, and the documentation on symfony.com covers ordering, references, groups, and services thoroughly.
Used by 3 apps in this directory
Kimai
Invoicing Finance · Project Management
Professional open-source time tracking with invoicing, multi-user support, SAML/LDAP auth, and a full REST API—self-host it or use the cloud.
Mautic
Automation · Marketing · Ecommerce
The world's largest open source marketing automation platform — own your data, run multi-channel campaigns, and escape vendor lock-in forever.
wallabag
Bookmarks Archiving
Self-hosted read-it-later app that saves clean, ad-free articles from any webpage for distraction-free reading across all your devices.