Search by

oligus / doctrine-fixtures

oligus

Doctrine fixtures

Package info

github.com/oligus/doctrine-fixtures

pkg:composer/oligus/doctrine-fixtures

Statistics

Installs: 6 656

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 1

0.2.1 2026-09-23 12:14 UTC

README

Simple fixture loader for Doctrine.

Build Status License: MIT Codecov.io Maintainability

Load XML fixtures into database using entity manager.

Quick start

$ composer require oligus/doctrine-fixtures --dev

Load all fixtures in a directory

$fixture = new FixtureManager($em, new XmlLoader('path/to/fixtures'));
$fixture->loadAll();

Load a single fixture file

$fixture = new FixtureManager($em, new XmlLoader());
$fixture->loadFile('path/to/fixtures/data_table.xml');

Availible Loaders

  • Xml Loader
  • Csv Loader

Fixtures

Creating XML fixture from mysql database

$ mysqldump -h localhost -u username --password=password --xml -t database data_table --where="id='1'"

Development

A PHP CLI container with Composer is provided, so tests and linting do not depend on the host's PHP version.

docker compose run --rm php composer install
docker compose run --rm php composer test
docker compose run --rm php composer lint

To get a shell inside the container (the repo is mounted at /app; exit to leave):

docker compose run --rm php bash

The default is PHP 8.4. Run against another version with PHP_VERSION, e.g. PHP_VERSION=8.1 docker compose run --rm php composer test. Each version gets its own vendor/ volume, separate from the host's.