- What is pecserke/yaml-fixtures-bundle and what does it do?
- It is a Symfony bundle that registers a Doctrine DataFixtures loader capable of reading YAML files, resolving references between fixture records, and persisting objects through the Doctrine ORM or ODM. Its value is authoring ergonomics: declarative YAML instead of verbose PHP fixture classes. It is not a fixture generator, does not produce fake data, and has no Eloquent support.
- Does pecserke/yaml-fixtures-bundle work with Laravel?
- No, not natively. The package depends on the Symfony bundle and dependency-injection lifecycle (Bundle class, Extension, service definitions), and Laravel has no bundle registration mechanism. Using it in Laravel would mean consuming the parser and reference-resolution logic and re-hosting it in an Artisan command, which is a port rather than an integration.
- Can I load YAML fixtures with Laravel db:seed?
- Not directly, because db:seed and Seeder classes expect PHP, and ModelFactory is the native path for test data. The cheaper option is to write a small custom Artisan command that parses YAML with symfony/yaml and creates Eloquent models yourself. That avoids porting a Symfony bundle and keeps you inside Laravel's seeding lifecycle.
- How do I install and register pecserke/yaml-fixtures-bundle?
- In a Symfony application you would require it with Composer, add the bundle to your kernel's bundle list, and configure it alongside doctrine/data-fixtures. Note that the last release was October 2019 and its Composer constraints likely conflict with PHP 8.1+ and Symfony 6/7, so a fork with widened constraints is usually required. Registering it in a Laravel app is not supported.
- Does it support references between fixture records?
- Yes, reference resolution between fixture records is a core feature, so one YAML entry can point at another previously defined record. The implementation relies on Doctrine DataFixtures API surfaces that have shifted across major versions, so verify behavior against your installed Doctrine version. Also watch for YAML parsing that is permissive enough to fail late and ambiguously.
- Which PHP and Symfony versions are supported?
- There is no demonstrated PHP 8.x or Symfony 5, 6, or 7 support in the available signals, and the last release was October 2019. Composer constraint conflicts with modern Laravel (PHP 8.1+ and Symfony ^6/^7 components) are likely and would force a fork. Check composer.json carefully and budget time for widening constraints and adding your own test coverage.
- Is pecserke/yaml-fixtures-bundle still maintained and safe to use?
- Signals are weak: single maintainer, around three stars, zero dependents, no observable CI, and a last release in October 2019. It is a dev and test-time dependency with no production runtime footprint, so the blast radius is limited to local and CI seeding, provided it never reaches a production data path. If you adopt it, plan to fork and own the code, which the MIT license permits.
- What are the alternatives to this YAML fixtures bundle?
- For Symfony and Doctrine, nelmio/alice with theofidry/alice-data-fixtures is the conventional answer: actively maintained, YAML-native, with Faker support and references. For Laravel, the native answer is Seeder classes plus ModelFactory driven by db:seed. Evaluate these before committing to a port of a dated bundle.
- Can it seed data into Eloquent models?
- No. The loader is built around Doctrine ORM and ODM persistence, not Eloquent, and Laravel's seeding lifecycle is separate. You would need a custom loader or port to work with Eloquent models. If you are not already running Doctrine ORM inside Laravel, this package is the wrong tool.
- How are fixtures loaded from the console?
- In Symfony you load them through the familiar Doctrine data fixtures console workflow, typically doctrine:fixtures:load. The bundle's wiring assumes that Symfony kernel context and its service container. In Laravel, db:seed does not understand YAML, so the equivalent would be a re-hosted Artisan command built around the parser logic.