PHP code example of northwoods / lazy-middleware

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

    

northwoods / lazy-middleware example snippets


use Northwoods\Middleware\LazyHandlerFactory;

/** @var ContainerInterface */
$container = /* any container */;

$lazyHandler = new LazyHandlerFactory($container);

/** @var \Psr\Http\Server\RequestHandlerInterface */
$handler = $lazyHandler->defer(Acme\FooHandler::class);

use Northwoods\Middleware\LazyMiddlewareFactory;

/** @var ContainerInterface */
$container = /* any container */;

$lazyMiddleware = new LazyMiddlewareFactory($container);

/** @var \Psr\Http\Server\MiddlewareInterface */
$middleware = $lazyMiddleware->defer(Acme\BarMiddleware::class);