This topic provides the download URL of the RAM SDK package for PHP. It also provides an example about how to use the SDK.

Download URL

RAM SDK package for SDK

Use the RAM SDK for PHP

The following sample code uses the RAM SDK for PHP to create a RAM user.

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

// Construct an Alibaba Cloud client. The client will be used to send a request.
// When you construct the client, set the AccessKey ID and AccessKey secret.
// RAM is a global service. However, the RAM API endpoint is located in the China (Hangzhou) region. Therefore, specify cn-hangzhou.
$iClientProfile = DefaultProfile::getProfile("cn-hangzhou", "<acccess-key-id>", "<access-key-secret>");
$client = new DefaultAcsClient($iClientProfile);

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

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

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