Download the PHP package fyre/middleware without Composer
On this page you can find all versions of the php package fyre/middleware. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package middleware
FyreMiddleware
FyreMiddleware is a free, open-source middleware library for PHP.
Table Of Contents
- Installation
- Middleware Queues
- Middleware
- Middleware Registry
- Request Handlers
Installation
Using Composer
Middleware Queues
Add
Add Middleware.
$middleware
is a MiddlewareRegistry alias.
Count
Get the Middleware count.
Current
Get the Middleware at the current index.
Insert At
Insert Middleware at a specified index.
$index
is a number representing the index.$middleware
is a MiddlewareRegistry alias.
Key
Get the current index.
Next
Progress the index.
Prepend
Prepend Middleware.
$middleware
is a MiddlewareRegistry alias.
Rewind
Reset the index.
Valid
Determine if the current index is valid.
Middleware
Custom middleware can be created by extending \Fyre\Middleware\Middleware
, ensuring all below methods are implemented.
Process
$request
is a ServerRequest.$handler
is a RequestHandler.
This method will return a ClientResponse.
The implemented method should call the handle
method of the RequestHandler to handle the next middleware in the queue.
Middleware Registry
Clear
Clear all aliases and middleware.
Map
Map an alias to middleware.
$alias
is a string representing the middleware alias.$middleware
is a string representing the Middleware class.
Resolve
Resolve Middleware.
$middleware
is a Middleware class instance or name, Closure or a MiddlewareRegistry alias.
You can pass additional arguments to the handle
method of the Middleware by appending a colon followed by a comma-separated list of arguments to the string.
Use
Load a shared Middleware instance.
$alias
is a string representing the middleware alias.
Request Handlers
$queue
is a MiddlewareQueue.$initialResponse
is a ClientResponse to be used as the initial response, and will default to null.$beforeHandle
is a Closure that will run before each middleware is handled, and will default to null.
If the $initialResponse
is set to null, a new ClientResponse will be created.
Handle
Handle the next middleware in the queue.
$request
is a ServerRequest.
This method will return a ClientResponse.