You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***The default request handler is responsible to provide a default response if none of the middlewares created one.***
39
+
***The default request handler MUST provide a default response if none of the middlewares created one.***
40
40
41
-
Some examples of "default request handler":
42
-
- with the [ADR pattern](https://en.wikipedia.org/wiki/Action%E2%80%93domain%E2%80%93responder), the default request handler might be your action class.
43
-
- with the [MVC pattern](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller), the default request handler might be the action method of your controller.
41
+
Some examples of what could be a "default request handler":
42
+
- with the [ADR pattern](https://en.wikipedia.org/wiki/Action%E2%80%93domain%E2%80%93responder), the default request handler might be your action class.*
43
+
- with the [MVC pattern](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller), the default request handler might be the action method of your controller.
44
44
45
-
It is possible to directly provide a `callable` and use the factory method `RequestHandler::fromCallable(callable $callable)`.
46
-
It will create an anonymous instance of RequestHandlerInterface wrapping the given `callable` inside.
45
+
It is possible to directly provide a `callable` and use the factory method `RequestHandler::fromCallable(callable $callable)`.
46
+
It will create an anonymous instance of RequestHandlerInterface wrapping the given `callable` inside.
Contains the middlewares and encapsulate the strategy used to store and retrieve the middlewares.
51
-
Some standard implementations are provided with different strategies: [stack (LIFO)](https://github.com/noglitchyo/middleware-collection-request-handler/blob/master/src/Collection/SplStackMiddlewareCollection.php), [queue (FIFO)](https://github.com/noglitchyo/middleware-collection-request-handler/blob/master/src/Collection/SplQueueMiddlewareCollection.php).
50
+
Contains the middlewares and defines the strategy used to store the middlewares and to retrieve the next middleware.
51
+
Some implementations with common strategies are provided: [stack (LIFO)](https://github.com/noglitchyo/middleware-collection-request-handler/blob/master/src/Collection/SplStackMiddlewareCollection.php), [queue (FIFO)](https://github.com/noglitchyo/middleware-collection-request-handler/blob/master/src/Collection/SplQueueMiddlewareCollection.php).
52
52
53
53
##### Example
54
54
@@ -63,7 +63,8 @@ use Psr\Http\Message\ServerRequestInterface;
63
63
use Psr\Http\Server\RequestHandlerInterface;
64
64
use Psr\Http\Message\ResponseInterface;
65
65
66
-
// Instantiate a collection of middleware.
66
+
// Instantiate a collection of middlewares with an anonymous middleware class.
67
+
// In this example, we are using a "stack" implementation of the collection.
67
68
$middlewareCollection = new SplStackMiddlewareCollection([
68
69
new class implements MiddlewareInterface{
69
70
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface{
0 commit comments