@@ -24,6 +24,13 @@ It currently ships with the following Diagnostic Checks:
2424 * [ SecurityAdvisory] ( #securityadvisory ) - check installed composer dependencies against SensioLabs SA database,
2525 * [ StreamWrapperExists] ( #streamwrapperexists ) - make sure given stream wrapper is available.
2626
27+ File validation checks:
28+
29+ * [ IniFile] ( #inifile ) - check if given INI file is available and valid,
30+ * [ JsonFile] ( #jsonfile ) - check if given JSON file is available and valid,
31+ * [ XmlFile] ( #xmlfile ) - check if given XML file is available and valid,
32+ * [ YamlFile] ( #yamlfile ) - check if given YAML file is available and valid
33+
2734## Using diagnostics with Zend Framework 2
2835
29361 . Install the [ ZFTool module] ( https://github.com/zendframework/ZFTool ) .
@@ -421,7 +428,6 @@ $checkLocal = new Memcache('127.0.0.1'); // default port
421428$checkBackup = new Memcache('10.0.30.40', 11212);
422429````
423430
424-
425431### PhpVersion
426432
427433Check if current PHP version matches the given requirement. The test accepts 2 parameters - baseline version and
@@ -489,7 +495,6 @@ $security = new SecurityAdvisory();
489495$security = new SecurityAdvisory('/var/www/project/composer.lock');
490496````
491497
492-
493498### StreamWrapperExists
494499
495500Check if a given stream wrapper (or an array of wrappers) is available. For example:
@@ -505,3 +510,52 @@ $checkCompression = new StreamWrapperExists(array(
505510 'zip'
506511));
507512````
513+
514+ ### IniFile
515+
516+ Read an INI-file from the given path and try to parse it.
517+
518+ ```` php
519+ <?php
520+ use ZendDiagnostics\Check\IniFile;
521+
522+ $checkIniFile = new IniFile('/my/path/to/file.ini');
523+ $checkIniFile = new IniFile(['file1.ini', 'file2.ini', '...']);
524+ ````
525+
526+ ### JsonFile
527+
528+ Read a JSON-file from the given path and try to decode it.
529+
530+ ```` php
531+ <?php
532+ use ZendDiagnostics\Check\JsonFile;
533+
534+ $checkJsonFile = new JsonFile('/my/path/to/file.json');
535+ $checkJsonFile = new JsonFile(['file1.json', 'file2.json', '...']);
536+ ````
537+
538+
539+ ### XmlFile
540+
541+ Read an XML-file from the given path, try to parse it and validate it agaist its DTD schema if possible.
542+
543+ ```` php
544+ <?php
545+ use ZendDiagnostics\Check\XmlFile;
546+
547+ $checkXmlFile = new XmlFile('/my/path/to/file.xml');
548+ $checkXmlFile = new XmlFile(['file1.xml', 'file2.xml', '...']);
549+ ````
550+
551+ ### YamlFile
552+
553+ Read a YAML-file from the given path and try to parse it.
554+
555+ ```` php
556+ <?php
557+ use ZendDiagnostics\Check\YamlFile;
558+
559+ $checkYamlFile = new YamlFile('/my/path/to/file.yml');
560+ $checkYamlFile = new YamlFile(['file1.yml', 'file2.yml', '...']);
561+ ````
0 commit comments