jimchen/aliyun-php-sdk-sts

aliyun php sdk sts

2.0.0 2021-04-26 04:58 UTC

This package is auto-updated.

Last update: 2024-11-26 13:26:25 UTC


README

阿里云STS SDK

Requirements

  • PHP 5.5+

Installing

$ composer require "jimchen/aliyun-php-sdk-sts:^2.0"

Usage

use JimChen\AliyunSts\Client;
$client = new Client(
        $accessKeyId,
        $accessKeySecret,
        $regionId,
        $clientName,
        $debug,
        $connectionTimeout,
        $timeout,
        $cert,
        $options
);

$result = $client->assumeRole()
    ->client($clientName)
    ->withRoleArn($roleArn)
    ->withRoleSessionName($roleSessionName)
    ->withDurationSeconds($durationSeconds)
    ->request();

$result->isSuccess();

In Laravel

$ php artisan vendor:publish --provider='JimChen\AliyunSts\LaravelProvider'
$result = app('aliyun.sts')->assumeRole()
    ->client($clientName)
    ->withRoleArn($roleArn)
    ->withRoleSessionName($roleSessionName)
    ->withDurationSeconds($durationSeconds)
    ->request();

$result->isSuccess();

for more api usage, see https://github.com/aliyun/openapi-sdk-php

License

Apache License 2.0