adrienlbt/hexagonal-maker-bundle
Symfony MakerBundle extension that scaffolds Hexagonal Architecture use cases. Generates a UseCase class plus Request/Response DTOs and a Presenter interface in a clean Domain folder structure, with optional configurable layer paths.
The Hexagonal Maker Bundle is a code generator for Symfony that automates the use case creation process for Hexagonal Architecture. It extends Symfony's Maker Bundle to generate properly structured use cases, requests, responses, and presenter interfaces.
Add the bundle with composer:
composer require --dev adrienlbt/hexagonal-maker-bundle
If Symfony Flex doesn't add the bundle automatically, activate it manually:
// config/bundles.php
return [
// ...
AdrienLbt\HexagonalMakerBundle\HexagonalMakerBundle::class => ['dev' => true]
];
That's it! The bundle is now ready to use. No additional configuration steps are required.
You can customize the default paths for your hexagonal architecture layers:
# config/packages/hexagonal_maker.yaml
hexagonal_maker:
application_path: 'Application' # Default
domain_path: 'Domain' # Default
infrastructure_path: 'Infrastructure' # Default
Run the following command and follow the interactive prompts:
bin/console make:hexagonal:usecase
This will generate:
Domain\UseCase\{folder}\{Name}Domain\Request\{folder}\{Name}RequestDomain\Response\{folder}\{Name}ResponseDomain\API\{folder}\{Name}PresenterInterfacebin/console make:hexagonal:usecase User CreateUser
# This generates:
# - Domain/UseCase/User/CreateUser.php
# - Domain/Request/User/CreateUserRequest.php
# - Domain/Response/User/CreateUserResponse.php
# - Domain/API/User/CreateUserPresenterInterface.php
The make:hexagonal:usecase command generates the following files:
src/
├── Domain/
│ ├── UseCase/{folder}/ # Use case implementations
│ ├── Request/{folder}/ # Request DTOs
│ ├── Response/{folder}/ # Response DTOs
│ └── API/{folder}/ # Presenter interfaces
Contributions are welcome! Please feel free to submit a Pull Request.
This bundle is released under the MIT License.
How can I help you explore Laravel packages today?