cocojr / clean-architecture
Clean architecture implementation
Installs: 22
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/cocojr/clean-architecture
Requires
- php: >=7.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.18
- phpmd/phpmd: ^2.9
- phpunit/phpunit: ^9.5
README
Work in progress
Architecture explanations
Installation
composer require cocojr/clean-architecture
Usage
First, you need to write the dispatcher, implementing the interface in CocoJr/CleanArchitecture/Business/Service/
.
You have 4 type of message:
- UseCase
- Event
- Query
- Command
From your application, dispatch only UseCase.
- UseCase can dispatch multiple Event, Query and Command.
- Event can dispatch multiple Query and Command.
- Command and Query can dispatch Event.
You have to separate your code using 2 folders:
- Application for your framework integration (or whatever).
- Business for your business logic.
In your Business folder, you write your code using only native functionnality. When you need a framework functionnality, you have to write an interface for it.
In your Application folder, you implement all of your Business interface, and dispatch the UseCase.
Example
- A complete symfony implementation, using a redis messenger bus is available here: TODO