Download the PHP package kleijnweb/php-api-middleware without Composer
On this page you can find all versions of the php package kleijnweb/php-api-middleware. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php-api-middleware
This project is no longer maintained
KleijnWeb\PhpApi\Middleware
Middleware for kleijnweb/php-api-descriptions.
Components
DefaultPipe
A complete chain of middleware that can process OpenAPI requests from begin to end, once you add some command handlers. The middleware in this section is executed in order listed.
You can append and prepend 3rd party middleware, ResultSerializer
is appended just before dispatching.
OperationMatcher
Determines which Operation object a request maps to (routing), or returning 404/405 responses respectively. Returns an request object some API description objects as well as the path parameters added as attributes.
BodyParsing
Parses the request body. In DefaultPipe
uses JsonBodyParser
but the parser is injectable.
ParameterAssembler
Coerces all the request data that qualify as OpenAPI parameters (bar the body) and sets them as request attributes.
MessageValidator
Validates the incoming request using the OpenAPI document and returns a 400 response with failure messages when invalid.
ParameterHydrator
Uses kleijnweb/php-api-hydrator
to hydrate custom typed objects and \DateTime
.
CommandDispatcher
Dead simple command dispatcher that invokes callable
s with the arguments in order as found in the request.
ResponseBodyDehydrator
Picks up the result of CommandDispatcher
and produces a response object.
Example
Verify that it works properly by starting a dev server and issuing some cURL requests:
Contributing
Pull requests are very welcome, but the code has to be PSR2 compliant, follow used conventions concerning parameter and return type declarations, and the coverage can not go down.
License
KleijnWeb\PhpApi\Middleware is made available under the terms of the LGPL, version 3.0.
All versions of php-api-middleware with dependencies
kleijnweb/php-api-descriptions Version ^v1.0.0-alpha4
kleijnweb/php-api-hydrator Version ^v1.0.0-alpha2
http-interop/http-middleware Version ^0.4.1
middlewares/utils Version ^0.11.0
psr/http-message Version 1.0
equip/dispatch Version ^0.3.1