Maurits van der Schee 5 years ago
parent
commit
61f740d568

+ 25
- 0
src/Psr/Http/Server/MiddlewareInterface.php View File

@@ -0,0 +1,25 @@
1
+<?php
2
+
3
+namespace Psr\Http\Server;
4
+
5
+use Psr\Http\Message\ResponseInterface;
6
+use Psr\Http\Message\ServerRequestInterface;
7
+
8
+/**
9
+ * Participant in processing a server request and response.
10
+ *
11
+ * An HTTP middleware component participates in processing an HTTP message:
12
+ * by acting on the request, generating the response, or forwarding the
13
+ * request to a subsequent middleware and possibly acting on its response.
14
+ */
15
+interface MiddlewareInterface
16
+{
17
+    /**
18
+     * Process an incoming server request.
19
+     *
20
+     * Processes an incoming server request in order to produce a response.
21
+     * If unable to produce the response itself, it may delegate to the provided
22
+     * request handler to do so.
23
+     */
24
+    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface;
25
+}

+ 22
- 0
src/Psr/Http/Server/RequestHandlerInterface.php View File

@@ -0,0 +1,22 @@
1
+<?php
2
+
3
+namespace Psr\Http\Server;
4
+
5
+use Psr\Http\Message\ResponseInterface;
6
+use Psr\Http\Message\ServerRequestInterface;
7
+
8
+/**
9
+ * Handles a server request and produces a response.
10
+ *
11
+ * An HTTP request handler process an HTTP request in order to produce an
12
+ * HTTP response.
13
+ */
14
+interface RequestHandlerInterface
15
+{
16
+    /**
17
+     * Handles a request and produces a response.
18
+     *
19
+     * May call other collaborating code to generate the response.
20
+     */
21
+    public function handle(ServerRequestInterface $request): ResponseInterface;
22
+}

Loading…
Cancel
Save