- What is Fabriq and how does it simplify Laravel model factories?
- Fabriq is a Laravel package focused on model factory and test-data workflows. It provides a fluent API for defining factory states and relationships so you can generate realistic fixtures with less boilerplate and keep test suites readable and consistent.
- How do I install Fabriq in a Laravel application?
- Install Fabriq through Composer using the package name karabinse/fabriq. After installation, follow the repository README for any Laravel auto-discovery, publishing, or configuration steps before using it in your factories.
- Which Laravel and PHP versions does Fabriq support?
- The repository is the authoritative source for Laravel and PHP version support. Check the composer.json constraints and the README compatibility notes before adding Fabriq to a project, especially if you are on an older Laravel release.
- How do I define states with Fabriq?
- Fabriq lets you define reusable factory states through a fluent API rather than repeating attribute arrays in every test. You can compose states to describe common model variants and keep test setup concise. See the README for the exact syntax and examples.
- Can Fabriq handle model relationships between factories?
- Yes, Fabriq is designed to streamline relationships in model factory and test-data workflows. It lets you express relationships fluently so related models can be generated consistently alongside the primary fixture. Review the package examples for the supported relationship patterns.
- Does Fabriq replace Laravel's built-in model factories?
- Fabriq complements rather than necessarily replaces Laravel's built-in model factories, depending on how you adopt it. It is aimed at making factory definitions and fixture generation more fluent and maintainable. Check the README for integration details and any limitations.
- How do I configure Fabriq for my Laravel project?
- Configuration depends on the package's published options and Laravel auto-discovery behavior. Start with the installation instructions in the repository README, then adjust any published config file or factory conventions for your application. If no config file is required, you can begin defining Fabriq factories directly.
- Can I use Fabriq with Pest and PHPUnit tests?
- Fabriq is built for Laravel test-data workflows, so it can be used in test suites that rely on Pest or PHPUnit. The exact integration approach depends on your factory setup, and the README should show usage examples. You can adopt it incrementally in existing tests.
- Is Fabriq suitable for production database seeding?
- Fabriq is primarily intended for model factories and test-data generation, not as a replacement for production data migration or seeding strategy. Be cautious about using any fixture generator against production databases, and keep test data workflows isolated. Use it where realistic fixtures improve development or testing.
- How does Fabriq compare with Laravel factories and other fixture packages?
- Fabriq focuses specifically on fluent model factory definitions and readable test fixtures in Laravel. Compare it with Laravel's native factories and other fixture packages based on your need for states, relationships, and maintainability. Check the GitHub repository for current maintenance activity, issues, and release history before adopting it.