PHPackages                             firstphp/tower - 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. firstphp/tower

ActiveLibrary

firstphp/tower
==============

Hyperf之Tower开发组件

1.0.4(6y ago)5132MITPHPPHP &gt;=7.2

Since Dec 20Pushed 6y ago1 watchersCompare

[ Source](https://github.com/lamplife/tower)[ Packagist](https://packagist.org/packages/firstphp/tower)[ RSS](/packages/firstphp-tower/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (4)Dependencies (7)Versions (5)Used By (0)

tower for hyperf
================

[](#tower-for-hyperf)

```
该组件封装了 Tower 几乎所有的 api，组件适用于 Hyperf 框架，通过对 Tower 获取 AccessToken、刷新 AccessToken 两个接口的封装，结合 Hyperf 定时任务，可以完全无需理会业务接口调用过程中所需考虑的 AccessToken 问题，组件会将最新 AccessToken 自动更新进 options 里面。
组件使用了 Redis 缓存来存储 AccessToken，请安装完组件依赖的同时，继而事先配置好 Redis

```

安装组件
----

[](#安装组件)

> composer require firstphp/tower

发布配置
----

[](#发布配置)

> php bin/hyperf.php vendor:publish firstphp/tower

获取Tower授权码（详见Tower开发文档）
-----------------------

[](#获取tower授权码详见tower开发文档)

> [https://tower.im/oauth/authorize?client\_id={client\_id}&amp;redirect\_uri=urn:ietf:wg:oauth:2.0:oob&amp;response\_type=code](https://tower.im/oauth/authorize?client_id=%7Bclient_id%7D&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code)

编辑.env配置
--------

[](#编辑env配置)

TOWER\_URL=CLIENT\_ID=ef8gd5cb1071e61483303432be7183af7c285993d74392364090bbdcb8710bbe CLIENT\_SERCET=903390ab427caf30a4824c3322d004562714f6c69de34158749bc11e6fd72ddf AUTH\_CODE=e1acb4311d6df4d86g5f83022f0eca8a592e1cbff94e55dcpac838e96beb3a40

Hyperf Demo
-----------

[](#hyperf-demo)

```
use Hyperf\Di\Annotation\Inject;

......

/**
 * @Inject()
 * @var \Firstphp\Tower\TowerInterface
 */
private $tower;

public function test() {
	// 初次访问调用一次即可，刷新Token可以单独放在计划任务里面定时刷新
    $this->tower->getAccessToken();

    // 获取当前账号信息
    $this->tower->getUser();
}

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~1 days

Total

4

Last Release

2335d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ec2904a42657def0df771f16258860306774a9a8de3e4b838816705c0c38fb43?d=identicon)[lamplife](/maintainers/lamplife)

---

Top Contributors

[![lamplife](https://avatars.githubusercontent.com/u/12744359?v=4)](https://github.com/lamplife "lamplife (2 commits)")

---

Tags

hyperftower

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/firstphp-tower/health.svg)

```
[![Health](https://phpackages.com/badges/firstphp-tower/health.svg)](https://phpackages.com/packages/firstphp-tower)
```

###  Alternatives

[hyperf-ext/jwt

The Hyperf JWT package.

53134.9k2](/packages/hyperf-ext-jwt)[hyperf/validation

hyperf validation

122.1M166](/packages/hyperf-validation)[hyperf/watcher

Hot reload watcher for Hyperf

17846.7k27](/packages/hyperf-watcher)[hyperf-ext/auth

The Hyperf Auth package.

2376.2k3](/packages/hyperf-ext-auth)[friendsofhyperf/sentry

The sentry component for Hyperf.

1864.6k](/packages/friendsofhyperf-sentry)[hyperf-ext/hashing

The Hyperf Hashing package.

1588.4k5](/packages/hyperf-ext-hashing)

PHPackages © 2026

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