middlewares/utils
Common utilities for Middlewares PSR packages: auto-discovered PSR-7/PSR-17 Factory (Diactoros, Guzzle, Slim, Nyholm, Sunrise) plus PSR-15 Dispatcher for testing, callable handler helpers, and HTTP error exceptions.
Factory as follows:
Factory::setFactory(
new FactoryDiscovery([
'request' => 'Zend\Diactoros\RequestFactory',
'response' => 'Zend\Diactoros\ResponseFactory',
'serverRequest' => 'Zend\Diactoros\ServerRequestFactory',
'stream' => 'Zend\Diactoros\StreamFactory',
'uploadedFile' => 'Zend\Diactoros\UploadedFileFactory',
'uri' => 'Zend\Diactoros\UriFactory',
])
);
FactoryInterface that returns all PSR-17 factoriesFactoryDiscovery class to discover automatically PSR-17 implementation librariesFactory::getFactory() and Factory::setFactory() to set manually PSR-17 factoriesFactory::getResponseFactory()Factory::getRequestFactory()Factory::getServerRequestFactory()Factory::getStreamFactory()Factory::getUriFactory()Factory::getUploadedFileFactory()Sunrise to the list of factories detected automaticallyFactory::setStrategyHttpErrorException::setContext method, to make the exception class inmutableHasResponseFactory and HasStreamFactoryMiddlewares\Utils\Dispatcher implements RequestHandlerInterface [#16], [#17]Nyholm\Psr7 to the list of factories detected automaticallyHasResponseFactory used by many middlewares that need to configure the PSR-17 response factory.HasStreamFactory used by many middlewares that need to configure the PSR-17 stream factory.Factory to return PSR-17 factories: getResponseFactory, getServerRequestFactory, getStreamFactory and getUriFactory.Factory::setStrategies() to configure the priority order of the Diactoros, Guzzle and Slim factories or register new classes.Callablehandler constructor to pass a response factoryhttp-interop/http-factory with psr/http-factoryFactory::createServerRequest() to be aligned with PSR-17Factory::createStream() to be aligned with PSR-17Factory::createResponse() to be aligned with PSR-17http-interop/http-factory to 0.4HttpErrorException from error handler middlewarehttp-interop/http-server-middleware with psr/http-server-middleware.Middlewares\Utils\Helpers because contains just one helper and it's no longer needed.RequestHandlerContainer implementing PSR-11 to resolve handlers in any format (classes, callables) and return PSR-15 RequestHandlerInterface instances. This can be used to resolve router handlers, for example.CallableHandler was simplified. Removed $resolver and $arguments in the constructor.RequestHandlerContainer, or any other PSR-11 implementation.http-interop/http-middleware with http-interop/http-server-middleware.Middlewares\Utils\CallableHandler signature. Now it is instantiable and can be used as middleware and server request handler.Middlewares\Utils\CallableMiddleware. Use Middlewares\Utils\CallableHandler instead..dist suffix to phpcs.xml and phpunit.xml fileshttp-interop/http-middleware to 0.5Middlewares\Utils\CallableHandler expects one of the following values returned by the callable:
Psr\Http\Message\ResponseInterfacenull or scalar__toString method implemented
Otherwise, throws an UnexpectedValueExceptionMiddlewares\Helpers::fixContentLength only modifies or removes the Content-Length header, but does not add it if didn't exist previously.Middlewares\Utils\Helpers with common helpers to manipulate PSR-7 messagesMiddlewares\Utils\Helpers::fixContentLength used to add/modify/remove the Content-Length header of a http message.http-interop/http-factory to 0.3container-interop by psr/contaienr (PSR-11).Middlewares\Utils\Dispatcher throws exceptions if the middlewares does not implement Interop\Http\ServerMiddleware\MiddlewareInterface or does not return an instance of Psr\Http\Message\ResponseInterface.Middlewares\Utils\Factory namespace.Middlewares\Utils\CallableHandler::resolvehttp-interop/http-middleware to 0.4friendsofphp/php-cs-fixer to 2.0Middlewares\Utils\Dispatcher::run to create and dispatch a request easilyMiddlewares\Utils\Dispatcher accepts Closure as middleware componentsMiddlewares\Utils\Dispatcher creates automatically a response if the stack is exhaustedMiddlewares\Utils\CallableMiddleware class, to create middlewares from callablesMiddlewares\Utils\Dispatcher class, to execute the middleware stack and return a response.http-interop/http-factory to 0.2Middlewares\Utils\CallableHandler class, allowing to resolve and execute callables safely.How can I help you explore Laravel packages today?