class Server implements OnRequestInterface, BootstrapsForServer

Properties

protected Kernel|null $kernel
protected string|null $serverName
protected Dispatcher|null $event

Methods

__construct(Container $container)

No description

void
bootstrapForServer(string $serverName)

Resolve the Kernel, sync middleware to Router, and trigger route compilation.

void
onRequest(Request $swooleRequest, Response $swooleResponse)

Handle an incoming Swoole HTTP request.

string
getServerName()

Get the server name.

setServerName(string $serverName)

Set the server name.

Details

at line 33
__construct(Container $container)

No description

Parameters

Container $container

at line 48
void bootstrapForServer(string $serverName)

Resolve the Kernel, sync middleware to Router, and trigger route compilation.

Called by the server boot process (Server\Server::registerSwooleEvents), before $server->start(). In SWOOLE_PROCESS mode this runs in the main process — workers inherit the compiled state via copy-on-write fork.

Parameters

string $serverName

Return Value

void

at line 70
void onRequest(Request $swooleRequest, Response $swooleResponse)

Handle an incoming Swoole HTTP request.

Transport only: Swoole → Bridge → Kernel → Bridge → Swoole. Also dispatches request lifecycle events when listeners are registered.

Parameters

Request $swooleRequest
Response $swooleResponse

Return Value

void

at line 171
string getServerName()

Get the server name.

Return Value

string

at line 185
Server setServerName(string $serverName)

Set the server name.

Boot-only. Mutates the worker-lifetime request handler before Swoole starts; runtime use races across requests and changes emitted server context.

Parameters

string $serverName

Return Value

Server