jimchen/aliyun-php-sdk-sts

阿里云 PHP SDK STS

2.0.0 2021-04-26 04:58 UTC

This package is auto-updated.

Last update: 2024-09-26 13:02:29 UTC


README

阿里云STS SDK

要求

  • PHP 5.5+

安装

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

使用方法

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();

在 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();

更多 API 使用方法,请参阅 https://github.com/aliyun/openapi-sdk-php

许可证

Apache License 2.0