Download the PHP package webservco/jsonapi-application without Composer
On this page you can find all versions of the php package webservco/jsonapi-application. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webservco/jsonapi-application
More information about webservco/jsonapi-application
Files in webservco/jsonapi-application
Package jsonapi-application
Short Description A PHP component/library. Request validation, document views, error objects and containers for JSON:API endpoints.
License MIT
Homepage https://webserv.co
Informations about the package jsonapi-application
webservco/jsonapi-application
A PHP component/library. Please see webservco/sandbox for an example project using these types of components.
Request validation, document views, error objects and containers for JSON:API endpoints.
- Related:
webservco/jsonapi(interfaces),webservco/form(the request handler works like a form),webservco/http-request-handler(AbstractApiDynamicRequestHandlerfor/api/v1/...routes),webservco/jwt(authentication)
Installation
Usage
This is a shortened version of the APIController in the webservco/sandbox project. The controller's local container implements APILocalServiceContainerInterface.
The module's request handler should offer JSONAPIRendererInterface and JSONRendererInterface as renderers.
Contracts
| Interface | Implementation | Purpose |
|---|---|---|
Contract\Service\JSONAPIHandlerInterface |
Service\Handler\JSONAPIItemHandler |
Checks method, content type and version, then fills form fields from data/attributes. |
Contract\Factory\Handler\JSONAPIHandlerFactoryInterface |
Factory\Handler\JSONAPIDefaultHandlerFactory |
Creates a handler for a list of methods (no fields). |
Contract\Service\JSONAPIRequestServiceInterface (webservco/jsonapi) |
Service\JSONAPIRequestService |
Content type check, version check and JSON body decoding. |
Contract\Service\Container\APILocalServiceContainerInterface |
Container\APILocalServiceContainer |
Local container for API controllers. |
Contract\Service\Container\APIJSONAPIServiceContainerInterface |
Container\APIJSONAPIServiceContainer |
Handler factory and request service. |
Contract\Errors\ErrorInterface (webservco/jsonapi) |
DataTransfer\Errors\DefaultError |
status, title, detail. |
Contract\ViewInterface (webservco/view) |
View\ItemView, View\CollectionView |
Top-level document with jsonapi, data or errors, and meta. |
Namespaces are relative to WebServCo\JSONAPI\. DataTransfer\Example\* are sample DTOs used by the sandbox project.
Notes
For methods that can have a body, the request must have Content-Type: application/vnd.api+json and "jsonapi": {"version": "1.1"}. Otherwise the handler adds an error with status 400. A GET request skips these checks.
A document has either data or errors. Pass null for the other one, and for jsonapi and meta when you don't need them. They are still encoded, as null.
Development
License
MIT
All versions of jsonapi-application with dependencies
fig/http-message-util Version ^1
psr/http-message Version ^2
webservco/data Version ^2
webservco/dependency-container Version ^2
webservco/form Version ^2
webservco/http Version ^2
webservco/jsonapi Version ^2
webservco/view Version ^2