craftcms/server-check
craftcms/server-check is a CLI utility to validate your server environment for running Craft CMS. It checks PHP version and extensions, required settings, and other dependencies, helping you quickly spot configuration issues before install or deployment.
craftcms/server-check package is a server requirements validator tailored for Craft CMS (a PHP-based CMS). It aligns well with Laravel-based projects if:
php-fpm, opcache, pdo_mysql).php artisan and config validation may suffice for core requirements, but this package offers Craft CMS-specific checks (e.g., composer.json constraints, Craft-specific PHP extensions like intl or gd)../vendor/bin/server-check (if installed via Composer).ServerCheck::validate() (if exposed).craft database tables).laravel/framework constraints).php artisan serve or php -m checks miss?phpunit, laravel-debugbar)?bcmath, fileinfo)?php -r "phpinfo();" output).composer require craftcms/server-check
composer.json under require-dev if only for local/CI checks.artisan commands).booted event or CI/CD scripts (e.g., GitHub Actions):
// Example: Run in a service provider
public function boot()
{
$validator = new \craftcms\servercheck\ServerCheck();
$result = $validator->validate();
if (!$result['isValid']) {
throw new \RuntimeException("Server requirements failed: " . print_r($result, true));
}
}
config/cache or opcache settings.session.save_path or open_basedir settings that Laravel ignores.composer install but before php artisan migrate).post-install-cmd in composer.json or a custom artisan command.opcache restarts).config('server_check.cache')).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Missing PHP Extension | Deployment fails | Add to Dockerfile or hosting config. |
| Incompatible PHP Version | Runtime errors | Upgrade PHP or adjust checks. |
| False Positive (Craft-Specific) | Unnecessary blockages | Filter checks or override rules. |
| CI/CD Pipeline Failure | Blocked deployments | Retry or bypass checks in emergencies. |
intl extension).How can I help you explore Laravel packages today?