ComposerDetector implements ResourceDetector
Read onlyYes
FinalYes
Detects service information from Composer's InstalledVersions.
Uses Composer's InstalledVersions class (available when using Composer's autoloader) to detect service name and version from the root package.
The service name is derived from the package name (vendor prefix is removed). The version is taken from the root package's pretty version or version.
Example usage:
$detector = new ComposerDetector();
$resource = $detector->detect();
// Returns: service.name => "my-app", service.version => "1.0.0"
Interfaces
- ResourceDetector
- Interface for detecting resource attributes from the environment.
Methods
Methods
detect()
Detect resource attributes from the environment.
public
detect() : Resource