Download the PHP package websoftwares/middleware without Composer
On this page you can find all versions of the php package websoftwares/middleware. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download websoftwares/middleware
More information about websoftwares/middleware
Files in websoftwares/middleware
Package middleware
Short Description This package lets u manage middleware for HTTP a request and response that implement the PSR-7 HTTP message interfaces.
License MIT
Informations about the package middleware
Middleware (v0.0.*)
This package lets u manage middleware for a HTTP request and response that implement the PSR-7 HTTP message interfaces
Psr\Http\Message\ServerRequestInterface
and Psr\Http\Message\ResponseInterface
.
Installing via Composer (recommended)
Install composer in your project:
Create a composer.json file in your project root:
Install via composer
Usage
Basic usage of the MiddlewareRunner
class.
Routing example with external package
Their are many excellent PHP router packages and in time some will be made compatible with PSR-7.
In this basic example we will show u how to use the MiddlewareRunner
class in conjunction with the latest development version of the Aura Router package.
Adapters
At the time of writing PSR-7 is almost on the horizon released :-) and their are many well written community supported HTTP orientated packages but most packages are not yet compliant.
To avoid mass rewrites of all these great packages or waiting for the author and or community to update them or holding out on the advantage of new compliant packages we can make use of the Adapter pattern to make them for example suitable for PSR-7 middleware.
Adapter RequestAuthenticatorAdapter example
The package acquia/http-hmac-php is an implementation of the HTTP HMAC Spec in PHP We want to validate the signature throw an exception or continue the middleware stack if it is a valid signature.
Changelog
- v0.0.11: Updated psr-7 psr/http-message to 1.0 and renamed phly/http with zendframework/zend-diactoros
- v0.0.10: Logic to exit on response added
- v0.0.9: Added abstract adapter and first implementation "acquia/http-hmac-php" package
Testing
In the tests folder u can find several tests.
Acknowledgement
Inspired by all the great middleware packages
License
The MIT License (MIT).