Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Data Fixtures

Data Fixtures Laravel Package

doctrine/data-fixtures

Doctrine Data Fixtures provides a simple way to define, manage, and execute fixture classes for loading sample or test data into Doctrine ORM or ODM. Useful for seeding databases, repeatable test setups, and development environments with consistent data.

View on GitHub
Deep Wiki
Context7

Doctrine2 ORM Data Fixtures Extensions

Frequently asked questions about Data Fixtures
Can I use doctrine/data-fixtures with Laravel Eloquent models?
No, this package is designed for Doctrine ORM/ODM entities only. If your Laravel app uses Eloquent, you’ll need a bridge like `laravel-doctrine/orm` or stick to Laravel’s native factories/fakers for Eloquent models.
How do I install doctrine/data-fixtures in a Laravel project?
Run `composer require doctrine/data-fixtures`. Ensure you also have `doctrine/orm` or `doctrine/odm` installed, as this package depends on them. Laravel doesn’t include Doctrine natively, so you may need to configure it via a bundle.
What’s the best way to organize fixtures for large datasets?
Group fixtures into logical sets (e.g., `UserFixtures`, `ProductFixtures`) and use the `Executor` class to load them in order. For large datasets, enable `PURGE_MODE_TRUNCATE` cautiously, as it can be slow. Consider dry-run mode for validation.
Does doctrine/data-fixtures support Laravel’s DatabaseSeeder?
No, this package doesn’t integrate directly with Laravel’s `DatabaseSeeder`. You’ll need to create a custom Artisan command or service provider to trigger fixtures via `php artisan` or your CI pipeline.
How do I handle circular dependencies between fixtures?
Avoid circular references by structuring fixtures hierarchically (e.g., load `User` fixtures before `Order` fixtures referencing them). If unavoidable, use lazy loading or transaction rollbacks to manage failures gracefully.
Is doctrine/data-fixtures suitable for production data seeding?
It’s primarily designed for development and testing. For production, use migrations or manual scripts. However, you can use dry-run mode to validate fixture logic without modifying live data.
What’s the performance impact of purging data before loading fixtures?
Purging (e.g., `TRUNCATE`) is fast for small datasets but can be slow for large tables. For CI/CD, consider `DELETE` mode or batch processing. Always test purge strategies in a staging environment first.
How do I test fixtures in a Laravel CI pipeline?
Trigger fixtures via a custom Artisan command (e.g., `php artisan db:seed-fixtures`) in your CI script. Use `PURGE_MODE_DELETE` to avoid locks, and wrap execution in transactions for rollback safety.
Are there alternatives to doctrine/data-fixtures for Laravel?
Yes: Laravel’s built-in factories/fakers are lighter but lack referential integrity. For hybrid setups, pair factories with this package—use fixtures for complex, related data and factories for simple models.
What Laravel versions and PHP requirements does doctrine/data-fixtures support?
The package requires PHP 8.1+ (post-v2.0.0) and works with any Laravel version, but you’ll need Doctrine ORM/ODM (PHP 8.1+ compatible). Laravel 9+ is recommended for seamless integration with modern PHP.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai