Install the KMS instance SDK (PHP)

更新时间:
复制 MD 格式

The Alibaba Cloud DKMS-GCS SDK for PHP lets you perform cryptographic operations and retrieve secret values using keys managed by your Key Management Service (KMS) instance.

Prerequisites

Before you begin, make sure you have:

Network requirements

The setup depends on where your application runs:

Install the SDK

Two installation methods are available:

Method 1 (recommended): Composer

Composer is the standard dependency manager for PHP. Using Composer keeps the SDK version pinned in your project and simplifies future upgrades.

  1. Add the SDK as a dependency using either approach:

    • Run the Composer command in your project's root directory:

      composer require alibabacloud/dkms-gcs-sdk
    • Or add the dependency manually to your composer.json file. Replace SDK_VERSION with the version number you want to install. We recommend using the latest version of the SDK. For available versions, see the open-source repository.

      "require": {
        "alibabacloud/dkms-gcs-sdk": "SDK_VERSION"
      }
  2. Run the following command in your project's root directory to install the dependency:

    composer install
  3. Include the Composer autoloader in your PHP code:

    require_once __DIR__ . '/vendor/autoload.php';

Method 2: Download source code

Download the SDK source code from the open-source repository, then include the SDK's autoloader in your PHP code:

require_once '/path/to/dkms-gcs-sdk/autoload.php';

Replace /path/to/dkms-gcs-sdk/ with the actual path to the downloaded SDK directory.