Skip to content
docs

EnvironmentDetectorService

Detects the runtime environment the application is executing under (command-line vs. web server).

EnvironmentDetectorService::detect()

public static function detect(): string

Returns 'cli' when running under the PHP command-line SAPI, otherwise 'web'.