PHPackages                             qcloud\_sts/qcloud-sts-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. qcloud\_sts/qcloud-sts-sdk

ActiveLibrary

qcloud\_sts/qcloud-sts-sdk
==========================

PHP SDK for QCloud STS

3.0.12(2y ago)10173.3k↓31.2%79MITPHPPHP &gt;=5.3.0

Since May 12Pushed 2y ago48 watchersCompare

[ Source](https://github.com/tencentyun/qcloud-cos-sts-php-sdk)[ Packagist](https://packagist.org/packages/qcloud_sts/qcloud-sts-sdk)[ Docs](https://github.com/tencentyun/qcloud-cos-sts-sdk)[ RSS](/packages/qcloud-sts-qcloud-sts-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (12)Used By (9)

获取 SDK
------

[](#获取-sdk)

- composer 安装

```
创建composer.json的文件，内容如下：
{
    "require":{
        "qcloud_sts/qcloud-sts-sdk": "3.0.*"
    }
}

```

查看示例
----

[](#查看示例)

请查看 [demo 示例](https://github.com/tencentyun/qcloud-cos-sts-sdk/tree/master/php/demo)，里面描述了如何调用SDK。

接口说明
----

[](#接口说明)

### getTempKeys

[](#gettempkeys)

获取临时密钥接口

### 参数说明

[](#参数说明)

字段类型描述secretIdstring云 API 密钥 IdsecretKeystring云 API 密钥 keydurationSecondslong要申请的临时密钥最长有效时间，单位秒，默认 1800，最大可设置 7200bucketstring存储桶名称：bucketName-appid, 如 test-125000000regionstring存储桶所属地域，如 ap-guangzhouallowPrefixstring资源的前缀，如授予操作所有资源，则为`*`；如授予操作某个路径a下的所有资源,则为 `a/*`，如授予只能操作特定的文件a/test.jpg, 则为`a/test.jpg`allowActionsarray授予 COS API 权限集合, 如简单上传操作：name/cos:PutObjectallowCiSourceboolean是否使用万象资源 true: 是，不传或false则无法使用万象资源policyarray策略：由 allowActions、bucket、region、allowPrefix字段组成的描述授权的具体信息### 返回值说明

[](#返回值说明)

字段类型描述credentialsstring临时密钥信息tmpSecretIdstring临时密钥 Id，可用于计算签名tmpSecretKeystring临时密钥 Key，可用于计算签名sessionTokenstring请求时需要用的 token 字符串，最终请求 COS API 时，需要放在 Header 的 x-cos-security-token 字段startTimestring密钥的起始时间，是 UNIX 时间戳expiredTimestring密钥的失效时间，是 UNIX 时间戳### 返回数据示例

[](#返回数据示例)

```
{
	"expiredTime": 1589258683,
	"expiration": "2020-05-12T04:44:43Z",
	"credentials": {
		"sessionToken": "Biypn6exa48PpMe7wFerEnNMpBKKPQo180c57e0a5275ebae506d7851a85f36a4P0TV5UFR3FYJjsoZA1tk6uRKoDRzc6-60BmwLqdS75OhjHEa7GlVYpL_ofKQJTpPKziKX7FnI10D_6qtLdjzf2NdsyUtQEd5kPpDCOQJZn9-BpleqWQe8oyH_2u7xi2f0FtjCYaoGIZ_lUqlILXQwr0B0t3hLfL4xNE-EmVjUlUXa16HxVCn4_hJetqo9LmI0AgLOjCbYx9aVrsV10eDsRta-TQSIXmJNP3aJ6oz8d8GBTgTE1I2qSFDnv9pjtQKW8HZWI_glPIfmHXCCwAESxEFL_owGz839Va0qYhF6LkfVmsuoU1zNcvJR1w3cIE6izV3SKHaOtWaew3IOervuOPoN3S2oYGNwv2EavtDAWyUBIeI7X6nMVzlpnyJ-3bkIhOq9QVIQAs8wh5A0u9mvKWugT5t6qgyEgvEZSj9k6p-JjwxMgLC6s5uK1i_nnf4fN7ZQ6I-JAfHnH4jEDiVtJgXqfuWPX_vnzskyR2Co6E",
		"tmpSecretId": "AKIDTRPc-oe6c_avPSRwFVsPDyy3IoAr3szMajlOGuoEXY1232YLy6j4f-xZ5zL-NBMG",
		"tmpSecretKey": "2v29SZztGYk6SGwHYm\/chJXdD3zPRFasmPoJiCmlR\/I="
	},
	"requestId": "69ef6295-b981-464d-9816-9c2ef92189d1",
	"startTime": 1589256883
}

```

### getRoleCredential

[](#getrolecredential)

申请扮演角色

### 参数说明

[](#参数说明-1)

字段类型描述必选roleArnstring角色的资源描述，可在 [访问管理](https://console.cloud.tencent.com/cam/role) 点击角色名获取。是secretIdstring云 API 密钥 Id是secretKeystring云 API 密钥 key是endpointstring接入点，内网填写"internal.tencentcloudapi.com"，外网填写"tencentcloudapi.com"是durationSecondslong要申请的临时密钥最长有效时间，单位秒，默认 1800，最大可设置 7200否bucketstring存储桶名称：bucketName-appid, 如 test-125000000是regionstring存储桶所属地域，如 ap-guangzhou是allowPrefixstring资源的前缀，如授予操作所有资源，则为`*`；如授予操作某个路径a下的所有资源,则为 `a/*`，如授予只能操作特定的文件a/test.jpg, 则为`a/test.jpg`是allowActionsarray授予 COS API 权限集合, 如简单上传操作：name/cos:PutObject是policyarray策略：由 allowActions、bucket、region、allowPrefix字段组成的描述授权的具体信息否externalIdstring角色外部ID否### 返回值说明

[](#返回值说明-1)

字段类型描述credentialsstring临时密钥信息tmpSecretIdstring临时密钥 Id，可用于计算签名tmpSecretKeystring临时密钥 Key，可用于计算签名sessionTokenstring请求时需要用的 token 字符串，最终请求 COS API 时，需要放在 Header 的 x-cos-security-token 字段startTimestring密钥的起始时间，是 UNIX 时间戳expiredTimestring密钥的失效时间，是 UNIX 时间戳### 返回数据示例

[](#返回数据示例-1)

```
{
  "Response": {
    "Credentials": {
      "Token": "da1e9d2ee9dda83506832d5ecb903b790132dfe340001",
      "TmpSecretId": "AKID65zyIP0mpXtaI******WIQVMn1umNH58",
      "TmpSecretKey": "q95K84wrzuEGoc*******52boxvp71yoh"
    },
    "ExpiredTime": 1543914376,
    "Expiration": "2018-12-04T09:06:16Z",
    "RequestId": "4daec797-9cd2-4f09-9e7a-7d4c43b2a74c"
  }
}

```

###  Health Score

38

—

LowBetter than 84% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~131 days

Recently: every ~153 days

Total

11

Last Release

871d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5ed77a8509263edabcd7f8f7158a65c02306677eaa8278f8bfe27f66543a29c5?d=identicon)[qcloudterminal](/maintainers/qcloudterminal)

---

Top Contributors

[![tuuna](https://avatars.githubusercontent.com/u/9778380?v=4)](https://github.com/tuuna "tuuna (9 commits)")[![nic12347](https://avatars.githubusercontent.com/u/25325632?v=4)](https://github.com/nic12347 "nic12347 (3 commits)")[![konakonall](https://avatars.githubusercontent.com/u/900060?v=4)](https://github.com/konakonall "konakonall (2 commits)")[![tksmai](https://avatars.githubusercontent.com/u/13465532?v=4)](https://github.com/tksmai "tksmai (1 commits)")

---

Tags

phpstsqcloudcos

### Embed Badge

![Health badge](/badges/qcloud-sts-qcloud-sts-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/qcloud-sts-qcloud-sts-sdk/health.svg)](https://phpackages.com/packages/qcloud-sts-qcloud-sts-sdk)
```

###  Alternatives

[qcloud/cos-sdk-v5

PHP SDK for QCloud COS

2051.5M129](/packages/qcloud-cos-sdk-v5)[qcloudsms/qcloudsms_php

qcloud sms php sdk

116262.3k20](/packages/qcloudsms-qcloudsms-php)[qcloud/cos-sdk-v4

PHP SDK for QCloud COS

4121.9k3](/packages/qcloud-cos-sdk-v4)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
