craftcms/server-check
Command-line and web-based server requirements checker for Craft CMS 4. Run via curl|bash on Unix-like systems or upload the server/ folder to get HTML or plain-text reports. Supports strict mode and CI/Docker-friendly exit codes.
bootstrap/app.php or a custom artisan command).RequirementsChecker class can be subclassed to add Laravel-specific checks (e.g., .env validation, Laravel extensions like laravel-debugbar).gd, intl, database timezone support), which may not apply to pure Laravel projects.composer require craftcms/server-check) and integrated via Artisan commands or service providers.check.sh script can be wrapped in a custom Artisan command (e.g., php artisan server:check) for seamless Laravel CLI integration.server/ folder can be deployed to /vendor/bin/server-check or a custom route (e.g., /server-check) for browser-based reports.CRAFT_STRICT_SERVER_CHECK for CI/CD pipelines, which can be mapped to Laravel’s .env (e.g., STRICT_SERVER_CHECK=true).opcache.save_comments) may require tuning for edge cases..env or config/ overrides (e.g., database DSN format).parallel: testing).fileinfo, mbstring, or pdo_mysql)?booted event), or both?::error) or log warnings (e.g., Laravel’s Log::warning)?php artisan optimize or laravel-debugbar provide overlapping functionality with less overhead?php artisan server:check) that wraps the check.sh script or checkit.php.// app/Console/Commands/ServerCheckCommand.php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class ServerCheckCommand extends Command {
protected $signature = 'server:check {--strict : Fail on warnings}';
public function handle() {
$strict = $this->option('strict') ? 'CRAFT_STRICT_SERVER_CHECK=1' : '';
$exitCode = shell_exec("{$strict} php /path/to/server-check/checkit.php");
if ($exitCode !== 0) $this->error('Server check failed!');
}
}
booted event (e.g., log warnings to Sentry or Slack)..github/workflows/ci.yml or gitlab-ci.yml:
- name: Server Check
run: curl -Lsf https://raw.githubusercontent.com/craftcms/server-check/HEAD/check.sh | bash
server/ to /vendor/craftcms/server-check/server and add a route:
// routes/web.php
Route::get('/server-check', function () {
return file_get_contents(__DIR__.'/vendor/craftcms/server-check/server/checkit.php');
})->name('server.check');
RequirementsChecker to include Laravel-specific checks (e.g., laravel-debugbar, telescope, or queue drivers) by subclassing:
use Craft\ServerCheck\RequirementsChecker;
class LaravelRequirementsChecker extends RequirementsChecker {
public function checkLaravelExtensions() {
return $this->checkExtension('laravel-debugbar', 'Laravel Debugbar');
}
}
craftcms/server-check as a dev dependency.composer require craftcms/server-check --dev
php artisan make:command ServerCheckCommand
STRICT_SERVER_CHECK to fail builds on warnings.server/ folder to a non-public route for manual validation.booted event to log warnings (e.g., via Sentry or Slack).craftcms/server-check:2.x.composer.json:
"require-dev": {
"craftcms/server-check": "^5.0"
}
CRAFT_STRICT_SERVER_CHECK in .env for CI/CD:
STRICT_SERVER_CHECK=true
php artisan server:check --strictHow can I help you explore Laravel packages today?