PHP code example of alexpts / psr15-middleware-manager
1. Go to this page and download the library: Download alexpts/psr15-middleware-manager 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/ */
alexpts / psr15-middleware-manager example snippets
use PTS\PSR15\MiddlewareManager\MiddlewareManager;
$manager = new MiddlewareManager;
$manager
->use($logMiddleware, '/admins/.*') // invoke only path /admins/.*
->use(new RequestWithAttribute(['container' => $container]))
->use(new RouterMiddleware);
$manager->handle($request);