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

Installs: 76

Dependents: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

v1.0.0-beta 2013-06-21 20:36 UTC

README

1) Loading rules

$validator = new Validator;
$validator->parseRulesFromJson($json);
//$validator->parseRulesFromFile($filepath);
//$validator->parseRulesFromArray($array);

2) Validation

$resultObject = $validator->validate($jsonDocument);

3) Getting result

$resultObject->isValid();

4. Getting errors if exist

if (!$resultObject->isValid()){
   $errors = $resultObject->getErrors();
}