Flow PHP

ChainDetector implements ResourceDetector

Read onlyYes
FinalYes

Combines multiple resource detectors into a chain.

Detectors are executed in order and their results are merged. Later detectors take precedence over earlier ones when there are conflicting attribute keys (allowing for override patterns).

This is useful for combining automatic detection with manual overrides:

$detector = new ChainDetector(
    new OsDetector(),           // Base OS detection
    new HostDetector(),         // Host information
    new ProcessDetector(),      // Process information
    new ComposerDetector(),     // Service from composer
    new EnvironmentDetector(),  // Environment overrides (highest precedence)
);

The recommended order is:

  1. Infrastructure detectors (OS, Host)
  2. Runtime detectors (Process)
  3. Application detectors (Composer)
  4. Environment overrides (EnvironmentDetector - should be last)

Interfaces

ResourceDetector
Interface for detecting resource attributes from the environment.

Methods

__construct()  : mixed
detect()  : Resource
Detect resource attributes from the environment.

Methods


        
On this page

Search results