PHP code example of larammerce / validation

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

    

larammerce / validation example snippets


return [
    "annotation_name" => "my_rules", // the rules will be read from @my_rules annotation.
    "dynamic_rules_key" => "dynamic_rules" // dynamic rules (described in docs) will be read from dynamic_rules key.
];

//Kernel.php file.
protected $routeMiddleware = [
    //...
    "rules" => Larammerce\Validation\Middleware\RulesMiddleware::class
];

//routes/web.php | routes/api.php file.
Route::get("/test-route", "App\Http\Controllers\HomeController@main")->middleware("rules");

//app/Http/Controllers/HomeController.php
class HomeController extends Controller {
    /**
     * @my_rules(title="icRules($title){
        //conditional rules according to passed data.
        return [
            $title."_input" => "
bash
php artisan vendor:publish --provider="Larammerce\Validation\ValidationServiceProvider"