Skip to content
/ alice Public
forked from nelmio/alice

Expressive fixtures generator

License

Notifications You must be signed in to change notification settings

reinfi/alice

 
 

Repository files navigation

Alice - Expressive fixtures generator Build Status

Relying on fzaninotto/Faker, Alice allows you to create a ton of fixtures/fake data for use while developing or testing your project. It gives you a few essential tools to make it very easy to generate complex data with constraints in a readable and easy to edit way, so that everyone on your team can tweak the fixtures if needed.

Note: v3 is on its way, get involved!

Table of Contents

  1. Installation
  2. Example
  3. Getting Started
  4. Basic Usage
  5. Detailed Usage
  6. Complete Reference
  7. Creating Fixtures
  8. Fixture Ranges
  9. Fixture Lists
  10. Calling Methods
  11. Specifying Constructor Arguments
  12. Custom Setter
  13. Optional Data
  14. Handling Unique Constraints
  15. Handling Relations
  16. References
  17. Multiple References
  18. Self reference
  19. Passing references to providers
  20. Keep Your Fixtures Dry
  21. Fixture Inheritance
  22. Including files
  23. Variables
  24. Parameters
  25. Customize Data Generation
  26. Faker Data
  27. Reuse generated data using objects value
  28. Custom Faker Data Providers
  29. Event handling with Processors
  30. Third-party libraries

Other references:

Installation

This is installable via Composer as nelmio/alice:

composer require nelmio/alice

Example

Here is a complete example of entity declaration:

Nelmio\Entity\User:
    user{1..10}:
        username: '<username()>'
        fullname: '<firstName()> <lastName()>'
        birthDate: '<date()>'
        email: '<email()>'
        favoriteNumber: '50%? <numberBetween(1, 200)>'

Nelmio\Entity\Group:
    group1:
        name: Admins
        owner: '@user1'
        members: '<numberBetween(1, 10)>x @user*'
        created: '<dateTimeBetween("-200 days", "now")>'
        updated: '<dateTimeBetween($created, "now")>'

You can then load them easily with:

$objects = \Nelmio\Alice\Fixtures::load(__DIR__.'/fixtures.yml', $objectManager);

For more information, refer to the documentation.

Third-party libraries

License

Released under the MIT License.

About

Expressive fixtures generator

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%