PHP code example of nigelgreenway / demander

1. Go to this page and download the library: Download nigelgreenway/demander 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/ */

    

nigelgreenway / demander example snippets

 php

$mapping = [
    'GetActiveEmployeesQuery' => 'GetActiveEmployeesQueryHandler',
];

$mediator = new Demander\Mediator\InMemoryMediator($mapping);

$activeEmployees = $mediator->request(new GetEmployeesByStatusQuery('active'));

foreach($activeEmployees as $activeEmployee) {
    echo $activeEmployee->fullName;
}