Cleanprospecter
Cleanprospecter is a php 7.2 business prospect application designed according to Robert C. Martin recommendations for clean architecture., (*1)
Add cleanprospecter in your project with composer., (*2)
$ composer require so-lean/cleanprospecter
A symfony 4.1 implementation can be found on github here, (*3)
Progress
Consider that scope as the minimal viable product., (*4)
- [x] As anonymous, I want to login
- [x] As main app, I want to refresh user
- [x] As prospector, I want to create organization
- [x] As prospector, I want to find my own organizations
- [x] As prospector, I want to get organization
- [x] As prospector, I want to update organization
- [x] As prospector, I want to create organization
- [x] As user, I want to get my account information
- [x] As user, I want to update my account information
- [x] As user, I want to remove my organization logo
- [ ] As prospector, I want to create prospect
- [ ] As prospector, I want to find my own prospects
- [ ] As prospector, I want to create phone call event
- [ ] As prospector, I want to create appointment event
- [ ] As prospector, I want to create email event
- [ ] As prospector, I want to create sms event
- [ ] As prospector, I want to find my own prospects
In the future
- tags
- auto import events from email box, short message service etc...
- email marketing campaign
Clean architecture -Business rules as a simple composer package.-
, (*5)
A good explanation is available in this Uncle Bob talk here, (*6)
A GOOD ARCHITECTURE MAXIMIZES THE NUMBER OF DECISIONS NOT MADE
- UNCLE BOB, (*7)
Terminological differences
In order to clarify some uncle bob concepts, (*8)
- Interactors becomes use cases and are locatated in src/UseCase/UseCaseName and take its name from it : ex FindMyOwnOrganizations
- Request an response are data transfer object and are located at the same place : ex FindMyOwnOrganizationsRequest, FindMyOwnOrganizationsResponse
- Presenter interface (Dependency inversion) too : ex FindMyOwnOrganizationsPresenter
- Gateways is not only database abstraction, entity gateway are located in src/Gateway/Entity
How to implement cleanprospecter
Clean architecture use dependency injection to build uses cases., (*9)
1 You need to implement all Gateways in your main application
* Build use cases in the IOC
* Register it in the facade., (*10)
// in IOC
//OrganizationGatewayImpl implements OrganizationGateway interface
$organizationGateway = new OrganizationGatewayImpl();
$useCase = new GetOrganizationImpl($organizationGateway);
//Create facade and register use case
$facade = new UseCasesFacade();
$facade->addUseCase($useCase);
// in controller (or somewhere else)
$request = new GetOrganizationRequest(7);
//presenter implements GetOrganizationPresenter
$presenter = new GetOrganizationPresenterImpl();
//all use case is accessible by their name
$facade->getOrganization($request, $presenter);
A use case can say what it does, (*11)
//...
$useCase = new GetOrganizationImpl($organizationGateway);
echo $useCase;
//Display : "As prospector, I want to get organization"
prerequisites
All common command lines are accessible by the Makefile.
Make create a docker image based on official php alpine docker image (php 7.2.3) with xdebug and composer installed globally., (*12)
$ make
Commands
make command, (*13)
Command |
comments |
build-env |
Build the docker env file tagged prospecter-run
|
composer |
install vendors |
composer-update |
update vendors |
test |
execute tests suite |
testdox |
execute tests and write agile documentation in text format |
test-coverage |
execute tests and generate report in html format |
cs |
code sniffer |
cs-fix |
fix automatically code sniffer errors |