PHP code example of spatial / mediator
1. Go to this page and download the library: Download spatial/mediator 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/ */
spatial / mediator example snippets
ire 'vendor/autoload.php';
use Core\Logic\Test\GetProduct;
use Spatial\Mediator\Mediator;
$mediator = new Mediator();
$r = $mediator->process(new GetProduct); // returns a Response
// view result
echo $r->getBody()->getContent();
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
class Mediator implements MiddlewareInterface{
public function process(ServerRequestInterface $request, ?RequestHandlerInterface $handler=null): ResponseInterface
{
return $handler->handle($request);
}
}