dgilan / json_doc_validator
There is no license information available for the latest version (v1.0.0-beta) of this package.
Library for validation json-documents according some specific rules
This package's canonical repository appears to be gone and the package has been frozen as a result.
v1.0.0-beta
2013-06-21 20:36 UTC
Requires
- php: >=5.3.3
- symfony/yaml: ~2.0
Requires (Dev)
- dgilan/phpsnifferhooks: dev-master
- instaclick/php-code-sniffer: dev-master
- klaussilveira/phpcs-psr: dev-master
- phpunit/phpunit: 3.7.*@dev
This package is not auto-updated.
Last update: 2022-04-11 02:10:13 UTC
README
- Loading rules
$validator = new Validator;
$validator->parseRulesFromJson($json);
//$validator->parseRulesFromFile($filepath);
//$validator->parseRulesFromArray($array);
- Validation
$resultObject = $validator->validate($jsonDocument);
- Getting result
$resultObject->isValid();
- Getting errors if exist
if (!$resultObject->isValid()){
$errors = $resultObject->getErrors();
}