1. Go to this page and download the library: Download pdxapps/preflight 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/ */
pdxapps / preflight example snippets
use PdxApps\Preflight\Preflight;
use PdxApps\Preflight\Steps\{Pint, Phpcs, Phpstan, Rector, Psalm, Phpmd, Tests};
return Preflight::configure()
// Explicit set + order (omit to auto-detect every installed tool):
->withSteps([
Pint::class,
Phpstan::make()->level(9)->memoryLimit('1G'),
Tests::make()->before(['php', 'artisan', 'config:clear']),
])
// Or keep the auto-detected default set and adjust it:
->tune(Psalm::make()->config('psalm.xml')) // tweak one, keep the rest
->without(Phpmd::class) // drop one
->withPaths(['app', 'src']) // what to scan (default: auto)
->failFast();
return Preflight::configure()
->fixByDefault() // a bare `preflight` fixes what it can (override: --check)
->dirtyByDefault() // ...scoped to working-tree changes (override: --all)
->defaultFormat('agent'); // ...and emits the agent format (override: --format=...)
use PdxApps\Preflight\Steps\AbstractStep;
use PdxApps\Preflight\Process\StepPlan;
use PdxApps\Preflight\Support\Tool;
use PdxApps\Preflight\Targeting;
use PdxApps\Preflight\Mode;
use PdxApps\Preflight\Context;
final class ComposerValidate extends AbstractStep
{
public function label(): string { return 'Composer Validate'; }
public function tool(): Tool { return Tool::system('composer'); }
public function modes(): array { return [Mode::Check]; }
public function targeting(): Targeting { return Targeting::Whole; }
public function defaultConfig(): ?string { return null; }
public function plan(Context $context, Mode $mode): StepPlan
{
return StepPlan::exitCode($this->name(), ['composer', 'validate', '--strict']);
}
}
use PdxApps\Preflight\Preflight;
use PdxApps\Preflight\Mode;
$config = ->isSuccess(); // bool
$result->findings(); // Finding[] (severity-sorted)
$result->toArray(); // the JSON shape
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.