symfony/requirements-checker
Symfony Requirements Checker is a small utility to verify your server meets Symfony’s requirements (PHP version, extensions, settings) before installing or deploying. Run it in CLI or via a web script to quickly spot missing dependencies and configuration issues.
symfony/requirements-checker:check).pdo_mysql, gd, or laravel-specific extensions).require symfony/requirements-checker (no Laravel-specific hooks needed).php artisan check:requirements).symfony/requirements-checker:check (e.g., fail builds on missing intl or mbstring).apcu) may not apply to Laravel. Risk mitigated by custom requirement files.systemd) are Symfony-specific; irrelevant for Laravel but harmless if ignored.redis, pgsql) to add to the requirement set?Log::error() for failures)?composer.json:
"scripts": {
"check-requirements": "symfony/requirements-checker:check"
}
- name: Check PHP requirements
run: vendor/bin/requirements-checker check
Phase 1: Lightweight Adoption
composer require symfony/requirements-checker --dev
composer.json scripts (run manually or via CI).Phase 2: Laravel Integration
app/Console/Commands/CheckRequirements.php):
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;
class CheckRequirements extends Command {
protected $signature = 'check:requirements';
protected $description = 'Check PHP/Laravel requirements';
public function handle() {
$process = new Process(['vendor/bin/requirements-checker', 'check']);
$process->run();
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
$this->info('All requirements satisfied!');
}
}
app/Console/Kernel.php:
protected $commands = [
Commands\CheckRequirements::class,
];
Phase 3: Customization
config/requirements.yml):
php:
version: ">=8.1"
extensions:
- pdo_mysql
- gd
- intl
laravel:
- "pdo_mysql extension must be enabled for database"
vendor/bin/requirements-checker check --config=config/requirements.yml
systemd or apcu; filter irrelevant checks.jobs:
check-requirements:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- run: composer install
- run: vendor/bin/requirements-checker check --config=config/requirements.yml
composer.json scripts for manual invocation:
"scripts": {
"dev:check": "check-requirements"
}
composer dev:check.symfony/requirements-checker for breaking changes (e.g., PHP version drops).composer.json (e.g., ^v1.0).config/requirements.yml.[ERROR] The intl extension is missing. Install it or check your PHP installation.
storage/logs/laravel.log for centralized monitoring.README.md or CONTRIBUTING.md (e.g., "Run composer check-requirements before contributing").composer validate).| Failure Type | Impact | Mitigation |
|---|---|---|
| Missing PHP Extension | Build/CI failure | Document required extensions in README.md. |
| PHP Version Mismatch | Local dev vs. CI discrepancies | Use phpversion in CI to enforce consistency. |
| Custom Requirement |
How can I help you explore Laravel packages today?