Copied!

Class containing functions used to build the Agent header.

CloneableInstantiable
Constants
public Google\ApiCore\AgentHeader::AGENT_HEADER_KEY = 'x-goog-api-client'
public Google\ApiCore\AgentHeader::UNKNOWN_VERSION = ''
Methods
public static buildAgentHeader(array $headerInfo)
 
  • param array $headerInfo { Optional.
    @type string $phpVersion the PHP version. @type string $libName the name of the client application. @type string $libVersion the version of the client application. @type string $gapicVersion the code generator version of the GAPIC library. @type string $apiCoreVersion the ApiCore version. @type string $grpcVersion the gRPC version. @type string $restVersion the REST transport version (typically same as the ApiCore version). @type string $protobufVersion the protobuf version in format 'x.y.z+a' where both 'x.y.z' and '+a' are optional, and where 'a' is a single letter representing the implementation type of the protobuf runtime. It is recommended to use 'c' for a C implementation, and 'n' for the native language implementation (PHP). 
    }
  • return array Agent header array
public static readGapicVersionFromFile(string $callingClass)
 

Reads the gapic version string from a VERSION file. In order to determine the file location, this method follows this procedure:

  • accepts a class name $callingClass
  • identifies the file defining that class
  • searches up the directory structure for the 'src' directory
  • looks in the directory above 'src' for a file named VERSION
  • param string $callingClass
  • return string the gapic version
  • throws \ReflectionException
Methods
public static buildAgentHeader(array $headerInfo)
 
  • param array $headerInfo { Optional.
    @type string $phpVersion the PHP version. @type string $libName the name of the client application. @type string $libVersion the version of the client application. @type string $gapicVersion the code generator version of the GAPIC library. @type string $apiCoreVersion the ApiCore version. @type string $grpcVersion the gRPC version. @type string $restVersion the REST transport version (typically same as the ApiCore version). @type string $protobufVersion the protobuf version in format 'x.y.z+a' where both 'x.y.z' and '+a' are optional, and where 'a' is a single letter representing the implementation type of the protobuf runtime. It is recommended to use 'c' for a C implementation, and 'n' for the native language implementation (PHP). 
    }
  • return array Agent header array
public static readGapicVersionFromFile(string $callingClass)
 

Reads the gapic version string from a VERSION file. In order to determine the file location, this method follows this procedure:

  • accepts a class name $callingClass
  • identifies the file defining that class
  • searches up the directory structure for the 'src' directory
  • looks in the directory above 'src' for a file named VERSION
  • param string $callingClass
  • return string the gapic version
  • throws \ReflectionException
© 2025 Bruce Wells