server.php

server.php Workerman wrapper for NovaFrame

Usage:

  • CLI/Workerman mode: php server.php start|stop|restart|reload -d
  • Traditional FPM: don't run this script; your existing index.php / front controller remains unchanged.

Notes:

  • This script initializes Framework per worker process on demand and uses Reflection to invoke framework internal flow for each request, avoiding modifying Framework.php / Kernel.php.

Constants

BASE_PATH

BASE_PATH = __DIR__

APP_ROOT

APP_ROOT = __DIR__

LOG_DIR

LOG_DIR = \APP_ROOT . '/storage/workerman'

HEALTH_FILE

HEALTH_FILE = \LOG_DIR . '/health.json'

MEMORY_LIMIT_MB

MEMORY_LIMIT_MB = 256

MEMORY_CHECK_INTERVAL

MEMORY_CHECK_INTERVAL = 10

Functions

log_info()

log_info(string  $msg) : void

Parameters

string $msg

convert_to_workerman_response()

convert_to_workerman_response(\Symfony\Component\HttpFoundation\Response  $res) : \Workerman\Protocols\Http\Response

Parameters

\Symfony\Component\HttpFoundation\Response $res

Returns

\Workerman\Protocols\Http\Response —

convert_to_symfony_request()

convert_to_symfony_request(\Workerman\Protocols\Http\Request  $request) : \Symfony\Component\HttpFoundation\Request

Parameters

\Workerman\Protocols\Http\Request $request

Returns

\Symfony\Component\HttpFoundation\Request —

update_health()

update_health() : void

rotate_logs()

rotate_logs() : void

checkFilesChange()

checkFilesChange(array  $watchDirs, array  $lastMtimes) : bool

Parameters

array $watchDirs
array $lastMtimes

Returns

bool —

startWorkerProcess()

startWorkerProcess() : mixed

Returns

mixed —

startMonitorLoop()

startMonitorLoop(mixed  $watchDirs) : void

Parameters

mixed $watchDirs

isWorkerProcess()

isWorkerProcess() : bool

Returns

bool —