Managing PHP function dependencies
Cloud Functions can automatically install dependencies required for a PHP function to run when creating a new function version.
Dependencies are installed by the composer install
command that is run in the project root (directory with the function). You can list the required libraries in the following ways:
-
Specify the libraries and their versions in the
composer.json
file:{ "require": { "guzzlehttp/guzzle": "~6.0", "ext-json": "*" } }
-
Run the
composer require <library>
command in the project root. This adds the library to thecomposer.json
file and installs it to thevendor
directory.
The dependency installation process has some technical restrictions. For more information, see Quotas and limits in Cloud Functions. You can view the dependency installation log using the link that appears in the list of operations.