h4cc/alice-fixtures-bundle
Symfony2 bundle for flexible data fixtures using nelmio/alice and Faker. Load fixtures from YAML/PHP, decouple from Doctrine DataFixtures, and optionally drop & recreate Doctrine ORM schema. Supports Doctrine ORM and MongoDB ODM. Work in progress (<1.0).
make:fixtures) with better integration.hautelook/AliceBundle for MongoDB-specific needs.dama/doctrine-test-bundle for newer projects.User fixtures for Order tests)."This package lets our dev team generate realistic test data on demand—no more manual SQL scripts or hardcoded placeholders. It’s like a ‘copy-paste’ for databases: we can spin up thousands of fake users, orders, or products with a single command, ensuring our tests reflect real-world scenarios. This reduces bugs in staging, speeds up CI pipelines, and cuts onboarding time for new hires. For our Symfony2 projects, it’s a lightweight, maintainable alternative to custom fixture scripts."
Key Outcomes:
*"The AliceFixturesBundle integrates nelmio/alice and Faker into Symfony2 to load fixtures from YAML/PHP files, with support for:
Why Not Alternatives?
Trade-offs:
Proposed Workflow:
Fixtures/Users.yml (e.g., App\Entity\User with fake names/emails).php bin/console h4cc_alice_fixtures:load:files Fixtures/Users.yml.fakePayment()) for domain-specific data.setUp() for consistent test environments.Example Fixture (YAML):
App\Entity\User:
user{1..10}:
email: <email>
roles: [ROLE_USER]
createdAt: <dateTimeBetween('-1 year', 'now')>
orders: '@order*'
Example Command:
# Load fixtures with German locale and drop schema
php bin/console h4cc_alice_fixtures:load:files \
--locale=de_DE \
--drop \
Fixtures/Users.yml Fixtures/Orders.yml
```"
---
**Call to Action**:
*"Let’s pilot this in [Project X]’s test suite to replace manual data setup. We’ll measure time saved in CI and developer onboarding."*
How can I help you explore Laravel packages today?