Download the PHP package shopware/fixture-bundle without Composer
On this page you can find all versions of the php package shopware/fixture-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package fixture-bundle
Shopware FixtureBundle
The FixtureBundle provides a flexible and organized way to load test data into your Shopware 6 application. It supports dependency management, priority-based execution, and group filtering.
Installation
Creating Fixtures
Basic Fixture
Create a class that implements FixtureInterface and add the #[Fixture] attribute:
Fixture with Priority
Higher priority fixtures are executed first:
Fixture with Dependencies
Specify other fixtures that must be loaded before this one:
Fixture with Groups
Organize fixtures into groups for selective loading:
Complete Example
Commands
Loading Fixtures
Load all fixtures:
Load only fixtures from a specific group:
Listing Fixtures
View all available fixtures and their execution order:
List fixtures from a specific group:
Example output:
Fixture Attributes
The #[Fixture] attribute accepts the following parameters:
- priority (int, default: 0): Higher values execute first
- dependsOn (array, default: []): Array of fixture class names that must run before this fixture
- groups (array, default: ['default']): Array of group names this fixture belongs to
Execution Order
Fixtures are executed in an order determined by:
- Dependencies: Fixtures with dependencies always run after their dependencies
- Priority: Among fixtures without dependency relationships, higher priority runs first
- Circular dependency detection: The system will throw an exception if circular dependencies are detected
Service Registration
Fixtures are automatically discovered and registered if they:
- Implement the
FixtureInterface - Have the
#[Fixture]attribute - Are registered as services (auto-configuration is enabled by default)
Theme Fixtures
The FixtureBundle provides a convenient way to configure theme settings through fixtures using the ThemeFixtureLoader and ThemeFixtureDefinition classes.
Basic Theme Fixture
Multiple Theme Configuration
Setting Logo
Theme Fixture Features
- Fluent Configuration: Chain multiple
->config()calls for readability - Automatic Theme Discovery: Finds themes by name automatically
- Change Detection: Only updates and recompiles when configuration actually changes
- Error Handling: Throws
FixtureException::themeNotFound()if theme doesn't exist - Automatic Recompilation: Theme is automatically recompiled after configuration changes
Available Configuration Fields
Common theme configuration fields include:
sw-color-brand-primary- Primary brand colorsw-color-brand-secondary- Secondary brand colorsw-border-radius-default- Default border radiussw-font-family-base- Base font familysw-background-color- Background colorsw-logo-desktop- Desktop logosw-logo-mobile- Mobile logosw-logo-tablet- Tablet logosw-logo-desktop-height- Desktop logo heightsw-logo-mobile-height- Mobile logo height
Note: Available fields depend on your theme's configuration schema defined in theme.json
Custom Field Fixtures
The FixtureBundle provides helper classes to easily create and manage custom fields through fixtures using CustomFieldSetFixtureLoader and related definition classes.
Basic Custom Field Fixture
Customer Fixtures
The FixtureBundle provides comprehensive customer management through fixtures using CustomerFixtureLoader and CustomerFixtureDefinition classes for creating test customers with addresses, custom fields, and relationships.
Basic Customer Fixture
Customer with Complete Information
Customer with Addresses
Guest Customer Fixture
Best Practices
- Use meaningful names: Name your fixtures clearly to indicate what data they create
- Organize with groups: Use groups to categorize fixtures (e.g., 'test-data', 'demo-data', 'performance-test', 'theme-config', 'customers')
- Declare dependencies explicitly: Always declare dependencies to ensure correct execution order
- Keep fixtures focused: Each fixture should have a single responsibility
- Make fixtures idempotent: Fixtures should be able to run multiple times without errors
- Use dependency injection: Inject the services you need rather than accessing the container directly
- Handle theme errors gracefully: Use try-catch blocks when configuring optional themes
- Use email as unique identifier: Customer fixtures use email as the primary identifier for updates vs. creation
All versions of fixture-bundle with dependencies
shopware/administration Version ^6.6.10
shopware/core Version ^6.6.10
shopware/storefront Version ^6.6.10