@@ -24,6 +24,13 @@ It currently ships with the following Diagnostic Checks:
24
24
* [ SecurityAdvisory] ( #securityadvisory ) - check installed composer dependencies against SensioLabs SA database,
25
25
* [ StreamWrapperExists] ( #streamwrapperexists ) - make sure given stream wrapper is available.
26
26
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
+
27
34
## Using diagnostics with Zend Framework 2
28
35
29
36
1 . Install the [ ZFTool module] ( https://github.com/zendframework/ZFTool ) .
@@ -421,7 +428,6 @@ $checkLocal = new Memcache('127.0.0.1'); // default port
421
428
$checkBackup = new Memcache('10.0.30.40', 11212);
422
429
````
423
430
424
-
425
431
### PhpVersion
426
432
427
433
Check if current PHP version matches the given requirement. The test accepts 2 parameters - baseline version and
@@ -489,7 +495,6 @@ $security = new SecurityAdvisory();
489
495
$security = new SecurityAdvisory('/var/www/project/composer.lock');
490
496
````
491
497
492
-
493
498
### StreamWrapperExists
494
499
495
500
Check if a given stream wrapper (or an array of wrappers) is available. For example:
@@ -505,3 +510,52 @@ $checkCompression = new StreamWrapperExists(array(
505
510
'zip'
506
511
));
507
512
````
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