PHP code example of ysp / webman-validate

1. Go to this page and download the library: Download ysp/webman-validate 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/ */

    

ysp / webman-validate example snippets


return [
    // ...
    \Ysp\WebmanValidate\Bootstrap::class,
];


namespace app\controller;

use support\Request;

class UserController
{
    public function store(Request $request)
    {
        try {
            $validated = validator($request, [
                'name' => 'ch (\Ysp\WebmanValidate\ValidationException $e) {
            return json(['errors' => $e->errors()->all()], 422);
        }
    }
}

return [
    'enable' => true,
    'locale' => 'en',
    'translation' => [
        'provider' => null, // Illuminate\Contracts\Translation\Translator
    ],
];