- Notifications
You must be signed in to change notification settings - Fork3
A PSR-15 middleware adapter for react/http
License
friends-of-reactphp/http-middleware-psr15-adapter
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Wraps PSR-15 middleware usingasync andawait fromreact/async utilizing fibers making them usable withinreact/http as middleware.
To install viaComposer, use the command below, it will automatically detect the latest version and bind it with^.
composer require for/http-middleware-psr15-adapterThe following usage example usesmiddlewares/redirect adding one redirect,and using the callback to call several methods on the redirect middleware to change it's behavior:
$server =newServer(/** Other middleware */newPSR15Middleware( (newRedirect(['/old-url' =>'/new-url']))->permanent(false)->query(false)->method(['GET','POST']) ),/** Other middleware */);
When using more then one PSR-15 in a row theGroupedPSR15Middleware is more performing than using multiplePSR15Middleware. Consider thefollowing example where we addmiddlewares/cache for expires headers:
$loop = Factory::create();$server =newServer([/** Other middleware */ (newGroupedPSR15Middleware($loop))->withMiddleware( (newRedirect(['/old-url' =>'/new-url']))->permanent(false)->query(false)->method(['GET','POST']) )->withMiddleware(newExpires() ),/** Other middleware */]);
About
A PSR-15 middleware adapter for react/http
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.