Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Cloud Functions
  • Comparison with other Yandex Cloud services
    • Overview
    • Managing dependencies
    • Request handler
    • Invocation context
    • Logging
    • Handling errors
  • Tools
  • Pricing policy
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  • FAQ

In this article:

  • Using the invocation context
  • Authentication in the Yandex Cloud API
  1. Developing in PHP
  2. Invocation context

PHP function invocation context

Written by
Yandex Cloud
Updated at February 27, 2023
  • Using the invocation context
    • Authentication in the Yandex Cloud API

Invocation context is an object that is accepted by the request handler of a PHP function as the second argument.

An invocation context is an object that provides additional information about a PHP function version properties. To get this information in your program, use the following methods:

  • 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, MB.
  • getRequestId(): Returns the ID of the request being handled.
  • getToken(): Returns the parameters required for authentication in the Yandex Cloud API.

Using the invocation contextUsing the invocation context

You can use the invocation context to authenticate in the Yandex Cloud API.

Authentication in the Yandex Cloud APIAuthentication in the Yandex Cloud API

If a function has a specified service account, the getToken() method returns a structure that contains information for authentication on behalf of this service account and provides the following set of methods to get this information:

  • getAccessToken(): The IAM token.
  • getExpiresIn(): The token lifetime in seconds.
  • getTokenType(): The token type (Bearer).

You can also get this information using the metadata service. For more information, see Authentication from within a VM.

Was the article helpful?

Previous
Request handler
Next
Logging
Yandex project
© 2025 Yandex.Cloud LLC