PHPackages                             theofidry/alice-data-fixtures - 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. theofidry/alice-data-fixtures

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

theofidry/alice-data-fixtures
=============================

Nelmio alice extension to persist the loaded fixtures.

1.11.0(5mo ago)32328.5M—7.1%77[5 issues](https://github.com/theofidry/AliceDataFixtures/issues)[3 PRs](https://github.com/theofidry/AliceDataFixtures/pulls)20MITPHPPHP ^8.4CI passing

Since Sep 12Pushed 1mo ago8 watchersCompare

[ Source](https://github.com/theofidry/AliceDataFixtures)[ Packagist](https://packagist.org/packages/theofidry/alice-data-fixtures)[ GitHub Sponsors](https://github.com/theofidry)[ RSS](/packages/theofidry-alice-data-fixtures/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (49)Used By (20)

AliceDataFixtures
=================

[](#alicedatafixtures)

[Alice](https://github.com/nelmio/alice) 3.x no longer ships with a persistence layer, so this library provides one!

[![Package version](https://camo.githubusercontent.com/a800eaaf9bd871dedfaf9a8fde10a90d84ff3e760806dfc538815e8a9295606a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7468656f66696472792f616c6963652d646174612d66697874757265732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/theofidry/alice-data-fixtures)[![Build Status](https://github.com/theofidry/AliceDataFixtures/workflows/Test/badge.svg?branch=master)](https://github.com/theofidry/AliceDataFixtures/actions?query=branch%3Amaster)[![Slack](https://camo.githubusercontent.com/a417e9b124e072be924465ed963504c2acc9d5f643b71ed4fd4d8378eb654c73/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f736c61636b2d253233616c6963652d2d66697874757265732d7265642e7376673f7374796c653d666c61742d737175617265)](https://symfony-devs.slack.com/shared_invite/MTYxMjcxMjc0MTc5LTE0OTA3ODE4OTQtYzc4NWVmMzRmZQ)[![license](https://camo.githubusercontent.com/10e85a5778fe7601504a17ecd18dfa7097f473186b0f947bc10db2d3e4f530e4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d7265642e7376673f7374796c653d666c61742d737175617265)](LICENSE)

Supports:

- Symfony 7.4+
- Doctrine ORM 3.3+
- Doctrine ODM 5.1+
- Doctrine PHPCR 2.0+
- Eloquent 12.0+

Documentation
-------------

[](#documentation)

1. [Installation](doc/installation.md/#installation)
    1. [Without Symfony](doc/installation.md/#without-symfony)
    2. [Symfony with Flex](doc/installation.md/#symfony-with-flex)
    3. [Symfony without flex](doc/installation.md/#symfony-without-flex)
        1. [Doctrine ORM](doc/installation.md/#doctrine-orm)
        2. [Doctrine ODM](doc/installation.md/#doctrine-odm)
        3. [Doctrine PHPCR](doc/installation.md/#doctrine-phpcr)
        4. [Eloquent ORM](doc/installation.md/#eloquent-orm)
        5. [Configuration](doc/installation.md/#configuration)
2. [Basic usage](#basic-usage)
3. [Configuration](#configuration)
4. [Advanced usage](doc/advanced-usage.md#advanced-usage)
    1. [Processors](doc/advanced-usage.md#processors)
    2. [Exclude tables from purge](doc/advanced-usage.md#exclude-tables-from-purge)
    3. [Usage in tests](doc/advanced-usage.md#usage-in-tests)
        1. [PHPUnit](doc/advanced-usage.md#phpunit)
        2. [Behat](doc/advanced-usage.md#behat)
5. [Contributing](#contributing)

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

[](#configuration)

The full configuration reference is:

```
# app/config/config.yml

# Default config
fidry_alice_data_fixtures:
    default_purge_mode: ~ # default is "delete" but you can change it to "truncate" or "no_purge"
    db_drivers:
        doctrine_orm: ~
        doctrine_mongodb_odm: ~
        doctrine_phpcr_odm: ~
        eloquent_orm: ~
```

For each driver, if the appropriate bundle is detected, e.g. DoctrineORMBundle for Doctrine and WouterJEloquentBundle for Eloquent, the services related to those driver will be enabled. If you want to skip those checks you can turn a specific driver to `true` instead. If you want to disable a specific driver, simply force the value `false` instead.

Basic usage
-----------

[](#basic-usage)

Create a fixture file in `src/AppBundle/Resources/fixtures`:

```
# src/AppBundle/Resources/fixtures/dummy.yml

AppBundle\Entity\Dummy:
    dummy_{1..10}:
        name:
        related_dummy: '@related_dummy*'
```

```
# src/AppBundle/Resources/fixtures/related_dummy.yml

AppBundle\Entity\RelatedDummy:
    related_dummy_{1..10}:
        name:
```

Then you can load those files using a `LoaderInterface`:

```
