punkrockio/laravel-schemarequest is a Laravel package for server side form validation using json schema.
It currently has 1 GitHub stars and 5 downloads on Packagist.
Install it with composer require punkrockio/laravel-schemarequest.
Discover more Laravel packages by punkrockio
or browse all Laravel packages to compare alternatives.
Last updated
Server side form validation using JSON Schema
Example
<?php
namespace App\Http\Requests;
use SchemaRequest\SchemaFormRequest as Request;
class PersonFormRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return '{
"type": "object",
"properties": {
"fname": {"type": "string", "maximum": 5},
"lname": {"type": "string", "minimum": 5},
"mname": {"type": "string", "minimum": 5},
"age": {"type": "integer", "minimum": 21},
"email": {"type": "string", "format": "email"}
}
}';
}
}