PHPackages                             gsylvestre/symfony-faker-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. gsylvestre/symfony-faker-fixtures

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

gsylvestre/symfony-faker-fixtures
=================================

Fast generation of realistic fake datas for your database. Symfony/Doctrine/Faker/Make super combo.

v2.0.1(5y ago)4104MITPHPPHP ^7.1CI failing

Since Oct 27Pushed 5y ago1 watchersCompare

[ Source](https://github.com/gsylvestre/symfony-faker-fixtures)[ Packagist](https://packagist.org/packages/gsylvestre/symfony-faker-fixtures)[ Docs](https://github.com/gsylvestre/symfony-faker-fixtures)[ RSS](/packages/gsylvestre-symfony-faker-fixtures/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (11)Versions (15)Used By (0)

Faker Fixtures Maker for Symfony
================================

[](#faker-fixtures-maker-for-symfony)

This bundle allows fast generation of realistic fake datas for your database, in the `make` style that we love. Huge thanks to the wonderfull [Faker library](https://github.com/fzaninotto/Faker/).

### Main features

[](#main-features)

- Zero config, easy to use
- Faker method selection based on entities attributes
- Handling of associations
- Fixtures order based on association dependencies
- For Symfony 4+

Installation
============

[](#installation)

Open a command console, enter your project directory and execute:

```
$ composer require gsylvestre/symfony-faker-fixtures
```

How to use
==========

[](#how-to-use)

1. Generate your new fixture command with:

    ```
    $ php bin/console make:faker-fixtures
    ```
2. Load magic datas in your database with:

    ```
    $ php bin/console app:fixtures:load
    ```

---

### Editing the fixtures

[](#editing-the-fixtures)

This bundle generates fixtures for you. Once done, you are free to edit them.

If needed (and it should), edit the generated `FakerFixturesCommand.php`:

1. To adapt the number of entities to generate, or the order
2. To adapt the Faker methods used and/or the logic

### Start over?

[](#start-over)

If you ever need to regenerates all your fixtures, you can do so by running:

```
$ php bin/console make:faker-fixtures --delete-previous
```

Be aware that *you will lose all changes* made to your fixtures command!

### Localize faker datas?

[](#localize-faker-datas)

If you want your generated datas localized, run:

```
$ php bin/console make:faker-fixtures --locale=fr_FR
```

---

Installation without Symfony Flex
---------------------------------

[](#installation-without-symfony-flex)

### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require gsylvestre/symfony-faker-fixtures
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `app/AppKernel.php` file of your project:

```
