RuntimeEnvironment

Class
Read only: Yes Final: Yes

Resolves common runtime-environment flags used by DevTools integrations.

Table of Contents

Interfaces

RuntimeEnvironmentInterface

Answers common runtime-environment questions from process environment flags.

Properties

Methods

 : mixed
isAgentPresent()

Returns whether the current process exposes known AI-agent environment markers.

 : bool
isCi()

Returns whether the current process runs in a CI environment.

 : bool
isComposerTestRun()

Returns whether the current process runs inside the Composer or PHPUnit test runtime.

 : bool
isEnabled()

Returns whether a truthy environment flag is enabled.

 : bool
isGithubActions()

Returns whether the current process runs in GitHub Actions.

 : bool
Properties
Methods

__construct()

Public
public __construct(EnvironmentInterface  $environment, Detector  $agentDetector) : mixed
Parameters
$environment : EnvironmentInterface

Description

reads raw process environment variables

$agentDetector : Detector

Description

detects known AI-agent environment markers

isAgentPresent()

Public

Returns whether the current process exposes known AI-agent environment markers.

public isAgentPresent() : bool
Return values
bool

isCi()

Public

Returns whether the current process runs in a CI environment.

public isCi() : bool
Return values
bool

isComposerTestRun()

Public

Returns whether the current process runs inside the Composer or PHPUnit test runtime.

public isComposerTestRun() : bool
Return values
bool

isEnabled()

Public

Returns whether a truthy environment flag is enabled.

public isEnabled( string  $name) : bool
Parameters
$name : string

Description

the environment variable name

Return values
bool

Description

true when the environment variable is enabled

isGithubActions()

Public

Returns whether the current process runs in GitHub Actions.

public isGithubActions() : bool
Return values
bool