PHP code example of so-lean / cleanprospecter

1. Go to this page and download the library: Download so-lean/cleanprospecter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

so-lean / cleanprospecter example snippets


    // 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);

   //...
   
   $useCase = new GetOrganizationImpl($organizationGateway);
   
   echo $useCase;
   
   //Display : "As prospector, I want to get organization"