dongkaipo / aliyun-php-sdk-green
Aliyun php sdk green composer support
dev-master
2019-01-15 12:35 UTC
Requires
- php: >=7.0
- ext-openssl: *
- dongkaipo/aliyun-php-sdk-core: dev-master
Requires (Dev)
- phpunit/phpunit: 7.5.x-dev
This package is auto-updated.
Last update: 2024-09-16 03:12:07 UTC
README
Install
composer reuqire dongkaipo/aliyun-php-sdk-sts
Usage
<?php
use Dongkaipo\Aliyun\Sts;
$sts = new Sts();
/**
* @param $regionId
* @param $accessKeyID
* @param $accessKeySecret
* @param $policy
* @param $roleArn acs:ram::1624292675336058:role/aliyunossadminrole' find at https://ram.console.aliyun.com/#/role/list
* @param $clientName
* @param int $tokenExpire
* @return array
* @throws Exception
*/
try {
$role = 'acs:ram::1624292675336058:role/aliyunossadminrole';
$token = $sts->requestToken('cn-beijing', '<accessKeyID>', '<accessKeySecret>', Sts::POLICY_ALL, $role, 'client_name');
} catch (Exception $exception) {
var_dump($exception);
}