PHP code example of hesami / laravel-json-validator

1. Go to this page and download the library: Download hesami/laravel-json-validator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hesami / laravel-json-validator example snippets


Validator::make($request->all(), [
    'movies' => ['json', 'json_object']
]);

Validator::make($request->all(), [
    'movies' => ['json', 'json_array']
]);

Validator::make($request->all(), [
    'movies' => ['json', 'json_object', 'json_object_has_key:title,desc']
]);

Validator::make($request->all(), [
    'movies' => ['json', 'json_array', 'json_array_items_has_key:title,desc']
]);

Validator::make($request->all(), [
    'movies' => ['json', 'json_array', 'json_array_items_numeric']
]);

Validator::make($request->all(), [
    'movies' => ['json', 'json_array', 'json_array_items_has_key:name', "json_array_items_distinct:name"]
]);

Validator::make($request->all(), [
    'movies' => ['json', 'json_array', "json_array_items_count:$count"]
]);

Validator::make($request->all(), [
    'movies' => ['json', 'json_array', "json_array_items_min:$min"]
]);

Validator::make($request->all(), [
    'movies' => ['json', 'json_array', "json_array_items_max:$max"]
]);

lng->en->validation.php