sylius/fixtures-bundle
Sylius Fixtures Bundle provides configurable data fixtures for Symfony apps. Define and load structured demo or test data through flexible configuration, ideal for seeding development environments and repeatable setups.
sylius/fixtures-bundle is a Symfony-specific solution, making it a natural fit for Laravel applications only if they are Symfony-adjacent (e.g., hybrid Laravel/Symfony stacks, legacy migration projects, or microservices using Symfony components).php artisan db:seed) and factories (Laravel\Factory) are more mature and tightly integrated than Symfony’s fixture system. This bundle does not natively support Laravel’s Eloquent ORM, requiring adapters or middleware to bridge the gap.symfony/framework-bundle), which is not native to Laravel. Integration would require:
spatie/laravel-symfony-support or custom middleware).| Risk Area | Assessment |
|---|---|
| ORM Mismatch | High risk if using Eloquent. Doctrine ORM (required by Symfony fixtures) would need adapters or dual-writes to Eloquent models. |
| Symfony Overhead | Medium risk. Introducing Symfony’s Kernel adds complexity (e.g., dependency injection, event system) that may bloat a Laravel app. |
| Maintenance Burden | Medium. Requires dual maintenance of fixture logic (Laravel seeds + Symfony fixtures) unless fully migrated to one system. |
| Performance | Low risk if used only for test data. High risk if used in production-like environments (e.g., slow fixture loading could impact CI/CD). |
| Tooling Gaps | High. Laravel’s artisan commands (e.g., db:seed) won’t natively work with Symfony fixtures, requiring custom CLI wrappers. |
Why Symfony Fixtures?
ORM Strategy
Scope of Adoption
Team Expertise
Long-Term Viability
| Laravel Component | Symfony Fixtures Bundle Fit |
|---|---|
| Eloquent ORM | ❌ No native support. Requires Doctrine ORM or custom adapters (e.g., mapping Eloquent models to Doctrine entities). |
| Database Seeding | ✅ Partial fit. Can replace php artisan db:seed if using Doctrine, but not Eloquent. |
| Factories (Laravel) | ❌ Incompatible. Symfony fixtures use static data definitions, while Laravel factories use dynamic model generation. |
| Migrations | ❌ No direct integration. Fixtures are post-migration data loading. |
| Testing (Pest/Tests) | ✅ Potential fit. Could centralize test data for hybrid Laravel/Symfony test suites. |
| API Testing | ✅ Fit for Symfony API Platform. If using Symfony’s API components, fixtures can preload test data for API contracts. |
Assess Scope
ORM Transition (If Needed)
Fixture Conversion
doctrine:fixtures:load instead of artisan db:seed.DatabaseSeeder.php to Symfony’s YAML/XML fixtures.# Symfony Fixture (YAML)
App\Entity\User:
user1:
email: 'user@example.com'
password: '$2y$10$...'
vs.
// Laravel Seeder
User::factory()->create(['email' => 'user@example.com']);
Command Integration
bin/console doctrine:fixtures:load directly (requires Symfony CLI).// app/Console/Commands/LoadSymfonyFixtures.php
public function handle() {
$kernel = new SymfonyKernel();
$kernel->boot();
$loader = $kernel->getContainer()->get('sylius_fixtures.loader');
$loader->load();
}
Testing Integration
| Compatibility Factor | Notes |
|---|---|
| PHP Version | Supports PHP 8.4/8.5 (matches Laravel 10/11). |
| Symfony Version | Supports Symfony 7/8 (requires Symfony Kernel in Laravel). |
| Doctrine ORM | Required for full functionality. Laravel’s Eloquent is not supported. |
| Laravel Service Providers | No conflict if Symfony Kernel is isolated (e.g., in a microservice). |
| Event System | Symfony’s event listeners can intercept fixture loading, but Laravel’s events are separate. |
Phase 1: Proof of Concept
spatie/laravel-symfony-support).Phase 2: ORM Alignment
How can I help you explore Laravel packages today?