Replace ServerStartCommand with WorkerRunner

FrankenPHP workers are PHP files started by the frankenphp binary, not console commands.
Extract the frankenphp_handle_request() loop into Http\WorkerRunner so apps can use it
directly from worker.php. Remove src/Command/ as it's no longer needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 16:22:02 +03:00
parent 98a4094c5e
commit df1d2a58bf
2 changed files with 21 additions and 9 deletions

View File

@@ -1,20 +1,17 @@
<?php
namespace Pronchev\Pinecore\Command;
namespace Pronchev\Pinecore\Http;
use Pronchev\Pinecore\ExceptionHandler;
use Pronchev\Pinecore\Http\HttpApplication;
use Pronchev\Pinecore\Console\ConsoleInput;
use Pronchev\Pinecore\Console\ConsoleOutput;
final class ServerStartCommand
final class WorkerRunner
{
public function __construct(
private readonly HttpApplication $app,
private readonly ExceptionHandler $exceptionHandler,
) {}
public function __invoke(ConsoleInput $input, ConsoleOutput $output): int
public function run(): void
{
$maxRequests = (int) ($_SERVER['MAX_REQUESTS'] ?? 0);
@@ -34,7 +31,5 @@ final class ServerStartCommand
break;
}
}
return 0;
}
}