Download the PHP package drpdigital/laravel-json-api-parser without Composer
On this page you can find all versions of the php package drpdigital/laravel-json-api-parser. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download drpdigital/laravel-json-api-parser
More information about drpdigital/laravel-json-api-parser
Files in drpdigital/laravel-json-api-parser
Package laravel-json-api-parser
Short Description Laravel integration for the jsonapi.org parser
License MIT
Informations about the package laravel-json-api-parser
JSON API parser for Laravel
This is a Laravel framework integration for the JSON API parser.
The JSON API parser allows you to read and validate requests that are structured with the jsonapi.org specification.
Version compatibility
JSON API Parser version | Laravel Version | PHP Version |
---|---|---|
1.X | 5.1 - 5.6 | >= 5.6 |
Installation
You install the package by using composer:
If you are using Laravel 5.5
onwards the package will automatically register itself.
If you are on Laravel 5.4
or lower then you will need to register the service provider in your config/app.php
Documentation
How to validate your resources
When wanting to validate a resource within your payload, you need to give the JsonApiValidator
a ValidatorExecutor
.
This can be done in a few ways specified below. With all of these the first parameter is a string of the type of resource it needs to validate.
So for example if you had a request like:
Then your first parameter would be 'user'
.
Using ::make
The rules and messages you provide are whatever Laravel can support as our validator is just a decorated for Laravel's.
Using custom class
When using a custom validator class you will need to extend our validator class \Drp\LaravelJsonApiParser\Validation\Validator
.
You then specify a rules
and messages
function inside the class and return an array of rules and messages in their respective functions.
How to resolve your resources into Models
For more documentation on how to use the JSON API parser please visit the base package's repository.
Sample Usage
The request:
The handler:
Contributing
Raise any issues or feature requests within GitHub and please follow our guidelines when contributing.
If you have found a security vulnerability with the package please email Chris directly at [email protected]
License
The Laravel JSON API Parser integration and it's base package are both realted under the [MIT License].
All versions of laravel-json-api-parser with dependencies
illuminate/validation Version 5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*
illuminate/support Version 5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*
illuminate/container Version 5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*