dongkaipo / aliyun-php-sdk-sts
Aliyun php sdk sts composer support
v1.0.7
2020-06-03 11:24 UTC
Requires
- php: >=7.0
- ext-openssl: *
- dongkaipo/aliyun-php-sdk-core: dev-master
Requires (Dev)
- phpunit/phpunit: ^7.4@dev
This package is auto-updated.
Last update: 2024-09-29 05:21:20 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);
}