A PHP library for generating expressive, customizable fake data fixtures for development and testing.
Nelmio/Alice is a PHP fixture generator that creates realistic, complex fake data for use in development and testing environments. It integrates with FakerPHP to produce readable and editable data definitions, making it easy for teams to manage and tweak fixtures as needed.
PHP developers and teams who need to generate structured, relational test data for applications, especially those using frameworks like Symfony, Nette, or Zend Framework 2.
Developers choose Alice for its expressive, human-readable fixture definitions that support complex relationships and constraints, its integration with FakerPHP for realistic data, and its maintainability features like inheritance and parameters to keep fixtures DRY.
Expressive fixtures generator
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Alice uses a human-readable DSL in YAML, PHP, or JSON formats, making complex data constraints easy to specify and edit by entire teams, as shown in the example with ranges and references.
Integrates tightly with FakerPHP to generate realistic, randomized data like names and emails, reducing manual fixture work through functions like <username()> and <dateTimeBetween()>.
Supports object references, self-references, and multiple references (e.g., '@user1' and '<numberBetween(1, 10)>x @user*'), essential for testing relational data models without manual linking.
Features like inheritance, file inclusion, variables, and parameters keep fixtures maintainable and reduce duplication, documented in the 'Keep Your Fixtures Dry' section.
The expressive DSL and dynamic generation can be slower for very large datasets, as acknowledged in the 'Performance' section of the advanced guide, making it less ideal for bulk data scenarios.
Alice 3.0 has significant breaking changes from 2.x, which is in maintenance mode, complicating upgrades for existing projects, as warned in the README and upgrade guide.
While supported via third-party libraries (e.g., hautelook/AliceBundle for Symfony), integration adds extra dependencies and setup steps, rather than being built-in or seamless.