symfony/runtime
Symfony Runtime decouples PHP applications from global state by centralizing bootstrapping and execution in a runtime layer. It enables flexible entry points, better testability, and smoother integration with different environments and frameworks.
$_SERVER, $_ENV, and $_FILES dependencies. The removal of Kernel::VERSION in this release further reduces coupling with legacy Symfony constructs, making it more Laravel-native.Runner class’s flexibility ensures component-by-component replacement remains viable.Kernel::VERSION reduces potential version-related attack vectors (e.g., info disclosure).Runner class integration remains minimal and non-intrusive:
// index.php (unchanged)
return Symfony\Component\Runtime\Runner::run(
new App\Kernel($_SERVER['APP_ENV'] ?? 'dev'),
$_SERVER['APP_RUNTIME'] ?? 'http'
);
Kernel::VERSION removal does not impact Laravel-specific functionality.$_SERVER['APP_RUNTIME'] remains unchanged. No operational impact.| Risk Area | Impact | Mitigation |
|---|---|---|
| Legacy Middleware | Middleware using $_SERVER breaks. |
Refactor priority: Replace $_SERVER-dependent middleware first. |
| PHP Version | v8.x requires PHP 8.4+. | Use v7.x for PHP 7.2+ compatibility (minor feature trade-offs). |
| Custom Bootstrapping | Overrides in index.php/artisan. |
Wrapper pattern: Encapsulate custom logic in the Runner class. |
| Performance Overhead | Runtime abstraction adds ~5ms. | Benchmark: Compare against native PHP-FPM (likely negligible). |
| Vendor Lock-in | Tight coupling with Symfony. | Abstraction layer: Use interfaces (e.g., RuntimeInterface) for swappability. |
| Debugging Complexity | Stack traces may hide runtime layers. | Tooling: Add APP_DEBUG=1 to expose runtime context in errors. |
| Kernel::VERSION Removal | Potential third-party reliance. | Audit: Check for external libraries using Kernel::VERSION (unlikely in Laravel). |
.env pollution) improve post-migration?$_SERVER/$_ENV dependencies in legacy code?make:command to auto-generate runtime-compatible commands?Kernel::VERSION affect any third-party Laravel packages or custom bootstrapping logic? (Low likelihood, but audit recommended.)| Component | Fit Level | Notes |
|---|---|---|
| Laravel 10+ | ✅ Perfect | Native Kernel integration; DI container compatibility. |
| Symfony Components | ✅ Perfect | Runtime, HttpClient, Cache, etc., are first-class citizens. |
| RoadRunner | ✅ Excellent | Auto-detects worker mode; zero-config async support. |
| FrankenPHP | ✅ Excellent | Built-in worker mode detection; memory savings. |
| AWS Lambda (Bref) | ✅ Good | Requires minor index.php wrapper; cold-start improvements. |
| Cloudflare Workers | ⚠️ Moderate | PHP Workers support is experimental; test thoroughly. |
| Legacy Middleware | ❌ Poor | Must refactor $_SERVER-dependent logic. |
| Custom Artisan Commands | ⚠️ Moderate | May need Runtime-aware argument resolution. |
(Unchanged from previous assessment, as the Kernel::VERSION removal does not impact migration steps.)
Phase 1: Global State Isolation (Low Risk)
.env/$_SERVER pollution in tests/CI.$_ENV with Runtime::getEnv().$_SERVER['HTTP_HOST'] with Request object.symfony/runtime:7.x for PHP 7.4+ compatibility.Phase 2: Runtime Unification (Medium Risk)
index.php and artisan in Runner::run().APP_RUNTIME env var for context detection.Phase 3: Serverless Expansion (High Risk/High Reward)
APP_RUNTIME=worker.symfony/runtime:8.x).symfony/runtime:8.x.symfony/runtime:7.x.Request objects.Kernel::VERSION (unlikely in Laravel, but verify).(Unchanged, as the release does not introduce breaking changes for Laravel.)
| Step | Effort | Dependencies | Blockers |
|---|---|---|---|
1. Add Runtime to composer.json |
Low | None | None |
2. Wrap index.php |
Medium | Laravel Kernel | Custom bootstrapping logic |
| 3. Refactor Middleware | High | $_SERVER/$_ENV usage |
Legacy codebase |
| 4. Test CI/CD | Medium | Pest/PHPUnit | Flaky tests |
| 5. Deploy RoadRunner | Medium | RoadRunner config | Worker-specific logic |
| 6. Optimize Serverless | High | Bref/RoadRunner | Cold-start latency |
Runner class manages HTTP/CLI/worker logic.Kernel::VERSION reduces potential version-related bugs in custom logic.$_SERVER replacements.How can I help you explore Laravel packages today?