Documentation / OmniPHP
Runtime & async I/O
A shared event loop, long-lived workers and explicit lifecycle hooks.
Application lifecycle
Application::boot defines paths and initializes configuration, logging and language support. Application::workerman configures the Fiber event loop and process files before Workerman starts.
HTTP client
Requests uses Fiber-aware I/O through the Workerman scheduler. Perform worker I/O inside a worker Fiber, not before fork. TLS verification is mandatory.
use OmniPHP\Http\Router;
use OmniPHP\Requests;
// Run inside a Workerman worker Fiber.
Router::get('/upstream', function () {
$response = Requests::get('https://example.com');
return ['status' => $response->statusCode];
});Process commands
Workerman exposes start, status, reload and stop commands. Use reload to re-fork workers after deploying compatible code changes.
php server.php start -d
php server.php status
php server.php reload
php server.php stopLong-running process safety
Keep request state in Context; process-level singletons must not leak user state across requests. Initialize connections in each worker and release resources during shutdown.