innovartingsas / laravel-hexagonal
Hexagonal architecture for Laravel
V2.1
2023-02-19 03:27 UTC
Requires
- php: ^7.3|^8.0|^8.2
- ext-json: *
- laravel/framework: ^9.0|^10.0
This package is auto-updated.
Last update: 2024-11-19 07:16:18 UTC
README
Laravel package that allows modifying the folder structure proposed by Laravel in its initial installation by a structure based on Hexagonal Architecture.
Install
composer require innovartingsas/laravel-hexagonal --dev
Implementation
In the root project execute artisan command
php artisan hexagonal:install --folder={NAME_FOLDER} --app-namespace={APP_NAMESPACE}
Or use the short form
php artisan hexagonal:install -f {NAME_FOLDER} -a {APP_NAMESPACE}
The namespace is automatically added to the psr-4
key of the compose.json file.
All files and folders found in the app folder will be moved to the Infrastructure folder found inside the folder defined in the --folder
option of the package installation command.
File structure created by the package
- App Folder Name
- Application
- Domain
- Entities
- Traits
- AddProps.php
- DeleteProps.php
- Serializable.php
- BaseEntity.php
- EntityId.php
- Traits
- Entities
- Infrastructure
- Console
- Exceptions
- Http
- Models
- Providers
Todo List
- Add CommandBus Contract
- Add Command and Handler Interface for UseCases
- Add custom Container Class
- Add binding for a CommandBus and Container Class
- Add Contracts folder inside Domain folder
- Add Repositories folder inside Domain folder
- Add commands for the creation of entities, factories, repositories and use cases.
License
The Laravel Hexagonal Package is open-sourced software licensed under the MIT license.