You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Théo FIDRY 96dc5d8314 Merge pull request #218 from egeloen/data-loader-container 6 years ago
src [DataLoader] Inject the service container 6 years ago
tests [DataLoader] Inject the service container 6 years ago
.editorconfig Travis improvements 6 years ago
.gitignore Merge pull request #128 from Soullivaneuh/ignore-path 6 years ago
.php_cs Use package autoload 6 years ago
.scrutinizer.yml Fix autoloading 6 years ago
.styleci.yml Remove deleted psr0 fixer for StyleCI 6 years ago
.travis.yml Merge pull request #208 from vincentchalamon/1.x 6 years ago Update 6 years ago
Makefile Use vendor phpunit + disable composer github oauth token 6 years ago Fix Kernel path 6 years ago Updating broken docs paths 6 years ago
composer.json Update ORM unit tests supporting MySQL & SQLite DB platforms 6 years ago
console Added license + Enhanced doc 7 years ago
phpunit.xml.dist Enable PHPUnit strict mode 6 years ago


A Symfony bundle to manage fixtures with nelmio/alice and fzaninotto/Faker.

Currently supports Doctrine ORM, Doctrine ODM, Doctrine PHPCR ODM.

Package version Build Status SensioLabsInsight Dependency Status Scrutinizer Code Quality Code Coverage HHVM support



  1. Install
  2. Basic usage
  3. Advanced usage
    1. Enabling databases
    2. Fixtures parameters
    3. Doctrine ORM
    4. Doctrine ODM (MongoDB)
    5. Doctrine PHPCR ODM
  4. Custom Faker Providers
    1. Simple Provider
    2. Advanced Provider
  5. Custom Alice Processors
  6. DoctrineFixturesBundle support
  7. Resources

Other references:


First you need install appropriate database managers (if you didn't install it yet), according to your project requirements. Check the documentation here.

You can use Composer to install the bundle to your project:

composer require --dev hautelook/alice-bundle doctrine/data-fixtures

Of course, the doctrine/data-fixtures library is only needed if you're using Doctrine.

Then, enable the bundle by updating your app/AppKernel.php file to enable the bundle:

// app/AppKernel.php

public function registerBundles()
    if (in_array($this->getEnvironment(), ['dev', 'test'])) {
        $bundles[] = new Hautelook\AliceBundle\HautelookAliceBundle();

    return $bundles;

Configure the bundle to your needs (example with default values):

# app/config/config_dev.yml

        orm: ~          # Enable Doctrine ORM if is registered
        mongodb: ~      # Enable Doctrine ODM if is registered
        phpcr: ~        # Enable Doctrine PHPCR ODM if is registered
    locale: en_US       # Locale to used for faker; must be a valid Faker locale otherwise will fallback to en_EN
    seed: 1             # A seed to make sure faker generates data consistently across runs, set to null to disable
    persist_once: false # Only persist objects once if multiple files are passed
    loading_limit: 5    # Maximum number of time the loader will try to load the files passed

Fore more information regarding the locale, refer to Faker documentation on localization.

Basic usage

Assuming you are using Doctrine, make sure you have the doctrine/doctrine-bundle and doctrine/data-fixtures packages installed.

Then create a fixture file in src/AppBundle/DataFixtures/ORM:

# src/AppBundle/DataFixtures/ORM/dummy.yml

        name: <name()>
        related_dummy: @related_dummy*
# AppBundle/DataFixtures/ORM/related_dummy.yml

        name: <name()>

Then simply load your fixtures with the doctrine command php app/console hautelook_alice:doctrine:fixtures:load (or php app/console h:d:f:l).

If you want to load the fixtures of a bundle only, do php app/console h:d:f:l -b MyFirstBundle -b MySecondBundle.

See more.
Next chapter: Advanced usage



This bundle was originaly developped by Baldur RENSCH and HauteLook. It is now maintained by Théo FIDRY.

Other contributors.