- How do I integrate this bundle into an existing Sylius Laravel project?
- Install via Composer (`composer require alexandrebulete/ddd-sylius-bundle`), enable the bundle in `config/bundles.php`, and configure Sylius resource paths in `sylius_resource.yaml`. The bundle leverages Sylius’s existing Admin UI and Grid systems, so no core Sylius changes are needed.
- Does this bundle support Laravel 10 with Symfony 6.2+?
- Yes, the bundle explicitly requires Symfony 6.2+ and PHP 8.2, which aligns with Laravel 10. Ensure your Sylius version is 1.11+ for full compatibility, as the bundle depends on Sylius’s Resource and Grid bundles.
- Can I use this bundle for a non-Sylius Laravel project?
- No, this bundle is tightly coupled to Sylius’s ecosystem (Admin UI, Grid, Resource bundles). If you’re not using Sylius, consider alternatives like Laravel Nova or custom admin panels for DDD patterns.
- How do I add a custom menu item for a bounded context like 'Post'?
- Create a `PostMenuContributor` class implementing `MenuContributorInterface`, annotate it with `#[AutoconfigureTag('app.menu_contributor')]`, and define the menu structure in the `contribute()` method. The bundle’s MenuBuilder will automatically register it in the Sylius Admin UI.
- What’s the best way to handle pagination in grids with this bundle?
- Use the `GridPageResolver` utility to extract pagination parameters from the Grid and Request objects. For example, `$page = GridPageResolver::getCurrentPage($grid, $parameters)` simplifies handling pagination logic in your bounded contexts.
- Are there any known performance issues with many bounded contexts contributing to the admin menu?
- The bundle’s MenuBuilder is designed for modularity, but heavy usage of bounded contexts may impact performance. Profile memory usage during menu rendering, especially if you have dozens of contexts contributing to the admin UI.
- How do I configure resource mapping for my DDD entities?
- Define resource paths in `sylius_resource.yaml` using glob patterns like `%kernel.project_dir%/src/*/Infrastructure/Sylius/Resource`. The bundle automatically scans these paths for Sylius resource configurations, reducing manual YAML maintenance.
- What alternatives exist for DDD + Sylius integration in Laravel?
- For DDD with Sylius, consider Sylius’s native `sylius/resource-bundle` for basic resource mapping or `hedgehog-labs/sylius-ddd` for more advanced DDD patterns. This bundle is niche but offers modular menu and grid utilities not found elsewhere.
- Does this bundle include tests for Sylius integration?
- The bundle does not explicitly mention Behat or functional tests in its documentation. Plan to write custom test suites for Sylius integration, especially if you rely on its Admin UI or Grid features.
- How do I handle conflicts with PHP 8.2’s strict typing (e.g., read-only properties) in legacy Sylius plugins?
- The bundle uses PHP 8.2 features like `readonly` classes, which may conflict with older Sylius plugins. Test thoroughly in your environment, and consider wrapping critical components (e.g., `GridPageResolver`) as standalone services if needed.