PHP code example of jralph / server-middleware
1. Go to this page and download the library: Download jralph/server-middleware 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/ */
jralph / server-middleware example snippets
use JRalph\ServerMiddleware\Dispatcher;
$dispatcher = (new Dispatcher())
->addMiddleware(
/**
* Implementations of Psr\Http\Server\MiddlewareInterface
*/
$firstMiddleware,
$secondMiddleware,
$thirdMiddleware
);
/** @var \Psr\Http\Message\ServerRequestInterface $request */
$request = new Request;
$response = $dispatcher->handle($request);