Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 774 Bytes

SlimLazyMiddleware.md

File metadata and controls

33 lines (24 loc) · 774 Bytes

SlimLazyMiddleware

Methods

process

<?php

use Chubbyphp\Framework\Middleware\SlimLazyMiddleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Some\Psr11\Container;
use Some\Psr7\ResponseFactory;
use Some\Psr7\ServerRequest;

$request = new ServerRequest();

$handler = new class() implements RequestHandlerInterface {
    public function handle(ServerRequestInterface $request): ResponseInterface
    {
        return new Response();
    }
};

$container = new Container();
$responseFactory = new ResponseFactory();

$lazyMiddleware = new SlimLazyMiddleware($container, 'middleware', $responseFactory);

$response = $lazyMiddleware->process($request, $handler);