1. Go to this page and download the library: Download fivelab/diagnostic library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fivelab / diagnostic example snippets
declare(strict_types = 1);
namespace Example;
use FiveLab\Component\Diagnostic\Check\Definition\CheckDefinitionsBuilder;
use FiveLab\Component\Diagnostic\Check\Definition\Filter\CheckDefinitionsInGroupFilter;
use FiveLab\Component\Diagnostic\Check\Definition\Filter\OrXFilter;
use FiveLab\Component\Diagnostic\Check\PathReadableCheck;
use FiveLab\Component\Diagnostic\Check\PathWritableCheck;
use FiveLab\Component\Diagnostic\Runner\Runner;
$builder = new CheckDefinitionsBuilder();
$builder->addCheck('cache_dir', new PathWritableCheck('./var/cache'), 'system_dir');
$builder->addCheck('logs_dir', new PathWritableCheck('./var/logs'), 'system_dir');
$builder->addCheck('shared_dir', new PathWritableCheck('./var/shared'), 'shared_dir');
$builder->addCheck('shared_efs', new PathReadableCheck('./var/shared/.efs'), 'shared_dir');
$builder->addCheck('tmp_dir', new PathWritableCheck('./var/tmp'), ['tmp_dir', 'system_dir']);
$definitions = $builder->build();
$runner = new Runner();
// Run all checks
$success = $runner->run($definitions);
// Run only for system dirs
$definitions = $definitions->filter(new CheckDefinitionsInGroupFilter('system_dir'));
$success = $runner->run($definitions);
// Run tmp dir and shared dir
$definitions = $definitions->filter(new OrXFilter(
new CheckDefinitionsInGroupFilter('tmp_dir'),
new CheckDefinitionsInGroupFilter('shared_dir')
));
$success = $runner->run($definitions);
namespace Example;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use FiveLab\Component\Diagnostic\DependencyInjection\AddDiagnosticToBuilderCheckPass;
$containerBuilder = new ContainerBuilder();
$containerBuilder->addCompilerPass(new AddDiagnosticToBuilderCheckPass());
$containerBuilder->compile();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.