PHP code example of cals / validator

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

    

cals / validator example snippets


Cals\Validator\ValidatorServiceProvider::class



namespace App\Http\Controllers;

use Cals\Validator\AjaxValidator;
use Illuminate\Http\Request;

class ExampleController extends Controller
{
    private $validator;
    
    public function __construct(AjaxValidator $validator)
    {
        $this->validator = $validator;
    }

    public function index(Request $request)
    {
        $values = $request->all();
        $this->validator->validate($values,'user');
    }
}

Bash
php artisan vendor:publish --tag="validator"