diff --git a/.phpdoc/guide/changelog.rst b/.phpdoc/guide/changelog.rst index 9486680..5ec1f72 100644 --- a/.phpdoc/guide/changelog.rst +++ b/.phpdoc/guide/changelog.rst @@ -6,6 +6,19 @@ Changelog .. sidebar:: Table of Contents .. contents:: +v1.2.0 +====== + +**Minor Changes:** + +* Added a `Warning` header to identify response messages from converted exceptions +* Removed the option to provide an exit status to :php:method:`OCC\PSR15\QueueRequestHandler::respond()` +* Added Composer command for development tools (PHP Mess Detector, Psalm Taint Analysis) + +**Maintencance:** + +* Updated dependencies + v1.1.0 ====== diff --git a/.phpdoc/guide/overview/queuerequesthandler.rst b/.phpdoc/guide/overview/queuerequesthandler.rst index a59665e..36ea86a 100644 --- a/.phpdoc/guide/overview/queuerequesthandler.rst +++ b/.phpdoc/guide/overview/queuerequesthandler.rst @@ -97,12 +97,10 @@ implements `Psr\Http\Message\ResponseInterface`. In case of an error the request handler catches any exception and creates a response with the exception code as status code (if it's within the valid range of HTTP status codes, otherwise it's set to `500 (Internal Server Error)`), and -the exception message as body. +the exception message as body. Such a response can be identified by having a `Warning` header set including the error +code and the affected middleware. Sending the Response -------------------- Sending the final response to the client is as easy as calling :php:method:`OCC\PSR15\QueueRequestHandler::respond()`. -Optionally, you can provide an exit code as argument (an integer in the range `0` to `254`). If you do so, script -execution is stopped after sending out the response and the given exit status is set. The status `0` means the request -was handled successfully, every other status is considered an error. diff --git a/.phpdoc/template/index.html.twig b/.phpdoc/template/index.html.twig index ebfd865..a557272 100644 --- a/.phpdoc/template/index.html.twig +++ b/.phpdoc/template/index.html.twig @@ -19,9 +19,11 @@ your own middleware, but you can just as well use any middleware that implements the middleware interface specified by PSR-15 (e.g. from the awesome PSR-15 HTTP Middlewares project).
-All components of this package follow the highest coding standards of PHPStan - and Psalm, and comply to PSR-12 - code style guidelines to make sure they can be combined and easily re-used in other projects.
+All components of this package follow the highest coding standards of Psalm, + PHPStan, PHP Mess Detector, + PHP_CodeSniffer, and comply to + PSR-12 code style guidelines to make sure they can be combined + and easily re-used in other projects.
A queue-based PSR-15 HTTP Server Request Handler.
@@ -442,9 +442,9 @@Create a queue-based PSR-15 HTTP Server Request Handler.
@@ -490,9 +490,9 @@Allow the request handler to be invoked directly.
@@ -546,9 +546,9 @@Handles a request by invoking a queue of middlewares.
@@ -604,16 +604,16 @@Return the current response to the client.
public
- respond([int|null $exitCode = null ]) : void
+ respond() : void
Exit status after sending out the response or NULL to continue
-Must be in the range 0 to 254. The status 0 is used to terminate the program successfully.
-Minor Changes: +
+ + + +Warning
+ header to identify response messages from converted exceptionsMaintencance: +
+ + + +Initial Release
-The AbstractMiddleware
- implements the
-Psr\Http\Server\MiddlewareInterface
-following PHP-FIG's recommendation PSR-15: HTTP Server Request Handlers.
Psr\Http\Server\MiddlewareInterface
+ following PHP-FIG's recommendation
+PSR-15: HTTP Server Request Handlers.
- processRequest()
method. It takes a request object as only argument and must return a
valid request object as well. Just make sure it follows PHP-FIG's standard recommendation
PSR-7: HTTP Message Interfaces and implements the
-Psr\Http\Message\ServerRequestInterface.
+Psr\Http\Message\ServerRequestInterface
+.
- processResponse()
method. It takes a response object as only argument and must return
a valid response object as well. Just make sure it follows PHP-FIG's standard recommendation
PSR-7: HTTP Message Interfaces and implements the
-Psr\Http\Message\ResponseInterface.
+Psr\Http\Message\ResponseInterface
+.
- Psr\Http\Server\MiddlewareInterface
+.
When instantiating a MiddlewareQueue
@@ -215,10 +216,10 @@ $queue->enqueue(new MiddlewareTwo());
The MiddlewareQueue
- is based on a
-OCC\Basics\DataStructures\StrictQueue.
OCC\Basics\DataStructures\StrictQueue
+.
- For a complete API documentation have a look at the StrictQueue.
-OCC\Basics\DataStructures\Exceptions\InvalidDataTypeException
Have a look at the AbstractMiddleware for an easy way to create your own middlewares!
-
The QueueRequestHandler
- implements the
-Psr\Http\Server\RequestHandlerInterface
-following PHP-FIG's recommendation PSR-15: HTTP Server Request Handlers.
Psr\Http\Server\RequestHandlerInterface
+ following PHP-FIG's recommendation
+PSR-15: HTTP Server Request Handlers.
For a minimal working example have a look at Usage.
-The server request is always available as QueueRequestHandler::request
. It follows PHP-FIG's standard recommendation
PSR-7: HTTP Message Interfaces and implements the
-Psr\Http\Message\ServerRequestInterface.
Psr\Http\Message\ServerRequestInterface
+.
When instantiating a QueueRequestHandler
@@ -286,16 +287,17 @@ $requestHandler->queue->enqueue(new MiddlewareTwo());
request data from superglobals. The property is reset each time the request is passed through a middleware and thus
always represents the current state of the request.
The response can be read as QueueRequestHandler::response
. It also follows PHP-FIG's standard recommendation
PSR-7: HTTP Message Interfaces and implements the
-Psr\Http\Message\ResponseInterface.
Psr\Http\Message\ResponseInterface
+.
When instantiating a QueueRequestHandler
@@ -308,11 +310,11 @@ always represents the latest state of the response.
Both, request and response, use the awesome implementations of Guzzle.
-handle()
method.
- Psr\Http\Message\ResponseInterface
In case of an error the request handler catches any exception and creates a response with the exception code as status
code (if it's within the valid range of HTTP status codes, otherwise it's set to 500 (Internal Server Error)
), and
-the exception message as body.
Warning
+ header set including the error
+code and the affected middleware.
- Sending the final response to the client is as easy as calling QueueRequestHandler::respond()
-.
-Optionally, you can provide an exit code as argument (an integer in the range 0
- to 254
-). If you do so, script
-execution is stopped after sending out the response and the given exit status is set. The status 0
- means the request
-was handled successfully, every other status is considered an error.
All available versions as well as further information about Requirements and dependencies can be found on Packagist.
-Be aware that you also need to make the classes available in your application by either adding them to your autoloader or by including all files individually in PHP. Also don't forget to do the same for all Requirements.
-As a last resort you can also just download the files. You can find all available versions as well as the current development state on the GitHub release page.
-MiddlewareTwo
).
- Well done! We now have two middlewares.
-And that's it!
-MiddlewareTwo
response status code to 500
.
- All components of this package follow the highest coding standards of PHPStan - and Psalm, and comply to PSR-12 - code style guidelines to make sure they can be combined and easily re-used in other projects.
+All components of this package follow the highest coding standards of Psalm, + PHPStan, PHP Mess Detector, + PHP_CodeSniffer, and comply to + PSR-12 code style guidelines to make sure they can be combined + and easily re-used in other projects.