In This Article

File Validation Checks

zendframework/zenddiagnostics ships with the following file validation checks.


Read an INI-file from the given path and try to parse it.

use ZendDiagnostics\Check\IniFile;

$checkIniFile = new IniFile('/my/path/to/file.ini');
$checkIniFile = new IniFile(['file1.ini', 'file2.ini', '...']);


Read a JSON-file from the given path and try to decode it.

use ZendDiagnostics\Check\JsonFile;

$checkJsonFile = new JsonFile('/my/path/to/file.json');
$checkJsonFile = new JsonFile(['file1.json', 'file2.json', '...']);


Read an XML-file from the given path, try to parse it, and attempt to validate it agaist its DTD schema if possible.

use ZendDiagnostics\Check\XmlFile;

$checkXmlFile = new XmlFile('/my/path/to/file.xml');
$checkXmlFile = new XmlFile(['file1.xml', 'file2.xml', '...']);


Read a YAML-file from the given path and try to parse it.

use ZendDiagnostics\Check\YamlFile;

$checkYamlFile = new YamlFile('/my/path/to/file.yml');
$checkYamlFile = new YamlFile(['file1.yml', 'file2.yml', '...']);

Found a mistake or want to contribute to the documentation? Edit this page on GitHub!