1. Go to this page and download the library: Download stamina/chequer-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/ */
stamina / chequer-php example snippets
if (Cheque::checkValue($value, $query)) {}
// build the query object
$chequer = new Chequer($query);
// use it witch check()
if ($chequer->check($value)) {}
// or invoke it as a function
if ($chequer($value)) {}
// or pass it as a callback
array_filter($array, $chequer);
// load the rules from the JSON file
Chequer::addGlobalRules(json_decode(file_get_contents('queries.json'), JSON_OBJECT_AS_ARRAY));
// reuse them
if (Chequer::checkValue($value, ['$rule' => 'some_defined_rule'])) {}
// load the queries once
$app['chequer.rules'] = $app->share(function() {
return json_decode(file_get_contents('queries.json'), JSON_OBJECT_AS_ARRAY);
});
// always have a fresh chequer on hand
$app['chequer'] = function() use ($app) {
return (new Chequer())->addRules($app['chequer.rules']);
};
// reuse
if ($app['chequer']->query($value, ['$rule' => 'some_defined_rule'])) {}
php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.