This topic describes how to install SDK for PHP.

Prerequisites

  • PHP is installed. For more information, see Install PHP.
    Note After the installation is complete, you can run the command php -v to check the PHP language version.
  • Install Composer. For more information, see Install Composer.

Install the SDK

You can use the following two methods to install the Alibaba Cloud SDK for Go:

  • Run the following commands to install SDK for PHP:
    composer require aliyunfc/fc-php-sdk
  • Install PHP SDK dependencies and import dependencies to PHP code.
    1. Declare the dependency of the composer.json PHP SDK in the Function Compute file.
       "require": {
            "aliyunfc/fc-php-sdk": "~1.2"
        }
    2. Use the following command to install dependencies:
      composer install --no-dev
    3. Import dependencies into PHP code.
      require_once __DIR__ . '/vendor/autoload.php';