PHP code example of mmagyar / typage-php
1. Go to this page and download the library: Download mmagyar/typage-php 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/ */
mmagyar / typage-php example snippets
$validator = new Object(
"myNumber0to10" => new Integer(0, 10),
"myStringArray" => new ArrayList(new Text()),
"singleWord" => new Text("/^\w+$/u"),
"optionalNumber" => new Nullable(new Double()),
"optionalWithDefault" => new Either(new Text(), "Hello World")
);
$validatedData = $validator->check($input, "request");