- How do I install this package in an existing Laravel 12/13 project?
- Run `composer require laravel-ddd/starter` in your project root, then execute `php artisan ddd:install` to trigger the interactive setup. The installer guides you through auth, modules, and testing configurations without manual file changes.
- Will this work with Laravel 11 or older versions?
- No, this package explicitly supports Laravel 12 and 13 only. It leverages PHP 8.4+ features like enums and attributes, which aren’t available in older Laravel versions.
- Can I skip the Eloquent repositories if I’m using Doctrine or another ORM?
- Yes, but you’ll need to manually implement custom repositories. The package provides `RepositoryInterface` contracts, so you can create Doctrine-based implementations while keeping the same domain structure.
- What happens if I choose ‘None’ for authentication during installation?
- The package won’t generate auth-related files (e.g., controllers, middleware). You can later add Laravel Breeze/Sanctum manually or use the `ddd:make-controller` command to scaffold auth-specific endpoints.
- How does this handle API versioning or OpenAPI/Swagger contracts?
- The package organizes routes by domain (e.g., `routes/domains/`) and supports API resources, but OpenAPI/Swagger integration isn’t built-in. You’ll need to extend the generated controllers or use third-party packages like `darkaonline/l5-swagger` alongside it.
- Are the generated tests compatible with Pest or only PHPUnit?
- Both! During installation, you select your test package (PHPUnit, Pest, or None). The generators create tests in your chosen framework’s syntax, so you can switch later by regenerating components.
- What’s the best way to integrate this with Laravel Nova for admin panels?
- Nova works best with Eloquent models, so ensure your repositories extend the provided `EloquentRepository`. Then, create Nova resources targeting your domain models. The package’s domain separation keeps Nova-specific logic isolated.
- How do I add a new module after initial installation?
- Use `php artisan ddd:make-module [Name]` to create a new domain (e.g., `Products`). This generates the full structure—entities, repositories, services, routes, and tests—while maintaining consistency with existing modules.
- Does this package support domain events or CQRS patterns?
- The base structure supports events via Laravel’s built-in `Event` system, but CQRS requires manual implementation. You’d need to extend the `Service` base class or create custom event handlers for commands/queries.
- What’s the performance impact of using repositories vs. direct Eloquent queries?
- Repositories add minimal overhead since they’re thin wrappers around Eloquent. For read-heavy operations, cache repository results using Laravel’s `Cache` facade or implement query caching in the repository layer.