This topic describes how to install Resource Management SDK for PHP and provides an example on how to use Resource Management SDK for PHP.

Background information

  • Alibaba Cloud provides OpenAPI Explorer to simplify API usage. You can use OpenAPI Explorer to debug API operations and dynamically generate SDK sample code.
  • For more information about Resource Management API operations, see List of operations by function.

Install the SDK for PHP

You can download the installation packages of the SDKs for PHP from the following links:


The following sample code provides an example on how to call the CreateResourceAccount operation by using the SDK for PHP. For other operations, you can use OpenAPI Explorer to debug the operations and obtain sample code.

use AlibabaCloud\Client\AlibabaCloud;
use AlibabaCloud\Client\Exception\ClientException;
use AlibabaCloud\Client\Exception\ServerException;
// Construct an Alibaba Cloud client that is used to initiate requests. 
// When you construct the client, specify your AccessKey ID and AccessKey secret. 
AlibabaCloud::accessKeyClient('<accessKeyId>', '<accessKeySecret>')
// Specify request parameters and initiate a request. For more information about the parameters, see API Reference. 
try {
    $result = AlibabaCloud::rpc()
                          // ->scheme('https') // https | http
                                        'query' => [
                                          'RegionId' => "cn-hangzhou",
                                          'DisplayName' => "<DisplayName>",
} catch (ClientException $e) {
    echo $e->getErrorMessage() . PHP_EOL;
} catch (ServerException $e) {
    echo $e->getErrorMessage() . PHP_EOL;