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

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

This package is not auto-updated.

Last update: 2022-04-11 02:10:13 UTC


README

  1. Loading rules
$validator = new Validator;
$validator->parseRulesFromJson($json);
//$validator->parseRulesFromFile($filepath);
//$validator->parseRulesFromArray($array);
  1. Validation
$resultObject = $validator->validate($jsonDocument);
  1. Getting result
$resultObject->isValid();
  1. Getting errors if exist
if (!$resultObject->isValid()){
   $errors = $resultObject->getErrors();
}