Download the PHP package germania-kg/middleware without Composer
On this page you can find all versions of the php package germania-kg/middleware. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download germania-kg/middleware
More information about germania-kg/middleware
Files in germania-kg/middleware
Package middleware
Short Description Collection of PSR-15 and PSR-7-style middleware
License MIT
Informations about the package middleware
Germania KG · Middleware
Collection of useful PSR-15 Single Pass and Double Pass middleware we use in our apps
Installation with Composer
LogHttpStatusMiddleware
Writes the HTTP Response's status code and reason to a PSR-3 Logger after $next has finished, using Psr\Log\LoggerInterface::info method. While this middleware is PSR-15 compliant, here a Slim3 example:
Class LogHttpStatusMiddleware also implements Psr\Log\LoggerAwareInterface
and additionally uses Germania\Middleware\LogLevelTrait
, so configure logging like this:
EmailExceptionMiddleware
While this middleware is PSR-15 compliant, here a Slim3 example:
Bonus: Display exception information
ScriptRuntimeMiddleware
Logs the time taken from instantiation to the time when the next middlewares have been executed. It uses the info() method described in PSR-3 LoggerInterface . While this middleware is PSR-15 compliant, here a Slim3 example:
Class ScriptRuntimeMiddleware also implements Psr\Log\LoggerAwareInterface
and additionally uses Germania\Middleware\LogLevelTrait
, so configure logging like this:
LogExceptionMiddleware
Logs information about exceptions thrown during next middlewares execution. It uses the warning() method described in PSR-3 LoggerInterface. While this middleware is PSR-15 compliant, here a Slim3 example:
Class LogExceptionMiddleware also implements Psr\Log\LoggerAwareInterface
and additionally uses Germania\Middleware\LogLevelTrait
, so configure logging like this:
Development
Clone that repo, dive into directory and install Composer dependencies.
Unit tests
Either copy phpunit.xml.dist
to phpunit.xml
and adapt to your needs, or leave as is. Run PhpUnit test or composer scripts like this:
All versions of middleware with dependencies
psr/log Version ^1.0
psr/http-message Version ^1.0
psr/http-server-middleware Version ^1.0