dgilan/json_doc_validator

Library for validation json-documents according some specific rules

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();
}