PHP code example of jpirnat / middleware
1. Go to this page and download the library: Download jpirnat/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/ */
jpirnat / middleware example snippets
$app = function (ServerRequestInterface $request) : ResponseInterface {
// This closure will be executed at the center of the middleware stack.
// Use it to wrap your application, or to return a default response.
}
$dispatcher = new Dispatcher($container, $app);
$dispatcher->addMiddlewares([
ExampleMiddleware::class, // identifiers for $container
// ...
]);
$response = $dispatcher->handle($request);