PHP function invocation context
Written by
Updated at July 2, 2026
Invocation context is an object that is accepted by the request handler of a function in PHP as the second argument.
This object provides additional information about a PHP function version properties. To get this information in your program, use the following methods:
getFunctionFolderId(): Returns the folder containing the function.getFunctionId(): Returns the string ID of the function.getFunctionVersionId(): Returns the string ID of the function version.getMemoryLimitInMB(): Returns the amount of memory specified when creating the version, in MB.getRequestId(): Returns the request ID.getToken(): Returns the parameters for authentication with the Yandex Cloud APIs.
Using the invocation context
You can use the invocation context to authenticate with the Yandex Cloud APIs.
Authentication with the Yandex Cloud APIs
If you specified a service account for the function, the getToken() method will return a structure with authentication information for that account. You can use the following methods to get this information:
getAccessToken(): IAM token.getExpiresIn(): Token lifetime, in seconds.getTokenType(): Token type, e.g.,Bearer.
You can also get this information using the metadata service. For more information about this method, see Authentication from within a VM.