This topic describes how to install PHP SDK and provides an operation example.

Installation

To download PHP SDK, click PHP SDK.

Example

The following is an example of how to create a RAM user by using PHP SDK:

<?php
include_once 'aliyun-php-sdk-core/Config.php';
use Ram\Request\V20150501 as Ram;

// Construct an Alibaba Cloud client to initiate a request.
// Set the access key ID and access key secret.
// Alibaba Cloud Resource Access Management (RAM) is a global service. Its API endpoint is China (Hangzhou). Here, set "Region" to "cn-hangzhou".
$iClientProfile = DefaultProfile::getProfile("cn-hangzhou", "<acccess-key-id>", "<access-key-secret>");
$client = new DefaultAcsClient($iClientProfile);

// Construct the "CreateUser" request.
$request = new Ram\CreateUserRequest();
// Set the "UserName" parameter.
$request->setUserName("alice");

// Initiate a request and obtain a response.
$response = $client->doAction($request);

print_r("\r\n");
print_r($response);
?>