- What is forkrefactor/ddd and what problem does it solve in Laravel?
- forkrefactor/ddd is a Domain-Driven Design toolkit for Laravel and PHP applications. It provides base classes and structure for entities, value objects, aggregates, repositories, domain events, commands, and handlers. The goal is to separate business logic from framework and infrastructure code so larger Laravel projects stay maintainable and testable.
- How do I install forkrefactor/ddd in a Laravel application?
- Install it as a Composer package with composer require forkrefactor/ddd. Laravel integration is handled through the package configuration and service providers described in the repository. Check the README for any publishable config or stub files and run the documented vendor:publish commands if they are provided.
- Which Laravel and PHP versions does forkrefactor/ddd support?
- The package is built for Laravel and PHP applications, but the exact supported Laravel and PHP versions depend on the release. Use the composer.json constraints and Packagist release metadata as the source of truth before installing. If you are on an older Laravel version, verify compatibility before adding it to production.
- What Artisan generators does forkrefactor/ddd provide?
- The package includes Artisan generators for domain classes and scaffolding. These commands help create the DDD building blocks consistently instead of writing boilerplate by hand. The generated output can be aligned with your team's conventions through customizable stubs.
- How does forkrefactor/ddd keep domain code independent of Laravel?
- It promotes a layered architecture that separates domain, application, and infrastructure concerns. Domain classes such as entities, value objects, and aggregates are intended to hold business rules without relying on framework code. Laravel-specific wiring is kept in configuration and service providers at the edges.
- Can I customize the stubs used by forkrefactor/ddd generators?
- Yes, the package advertises customizable stubs so generated classes can match your team's naming and structure conventions. The usual workflow is to publish or override the package stubs and then adjust them to your standards. Review the README for the exact stub paths and publish command for your version.
- How do commands, handlers, and domain events work together in forkrefactor/ddd?
- The package provides base classes for commands, handlers, and domain events as part of its DDD foundation. Commands represent application actions, handlers coordinate the work, and domain events capture meaningful business changes. The explicit boundaries help keep that flow organized and testable.
- Is forkrefactor/ddd only for new Laravel projects or can I use it in an existing app?
- It can be introduced incrementally because it is a foundation of base classes and boundaries rather than a full replacement for Laravel. You can start by modeling one bounded context and moving business logic into domain classes over time. Existing framework and infrastructure code can remain at the edges while you refactor.
- How should I test domain logic built with forkrefactor/ddd?
- Because the domain layer is meant to be independent of the framework, entities, value objects, aggregates, and domain events can be tested with plain unit tests. Repositories and other infrastructure concerns are better covered with integration tests or test doubles at the boundary. This separation is one of the main reasons to use the package in a growing Laravel codebase.
- How does forkrefactor/ddd compare with other Laravel DDD packages?
- forkrefactor/ddd focuses on providing a DDD foundation: base classes, generators, explicit boundaries, and Laravel service provider wiring. It is not a full application framework, so you should compare it with alternatives based on the specific building blocks and conventions you need. Review the repository and README to confirm whether its scope matches your architecture.