PHP code example of wegar / validate
1. Go to this page and download the library: Download wegar/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/ */
wegar / validate example snippets
use Wegar\Validate\Annotation\Method\GET;
class ExampleController {
/**
* POST /example/index => Method not allowed or 404
* GET /example/index => Hello World!
*/
#[GET]
function index(){
return response('Hello World!');
}
/**
* POST /example/page => Hello Page!
* GET /example/page => Hello Page!
* ...
*
* if app.force = true
* POST /example/page => Method not allowed
* GET /example/page => Method not allowed
* ...
*
* if app.force = true and app.throw=false
* POST /example/page => 404
* GET /example/page => 404
* ...
*/
function page(){
return response('Hello Page!');
}
}
use Wegar\Validate\Annotation\Method\GET;
class ExampleController {
#[GET(
'field' => '
}
}