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. [Utility &amp; Helpers](/categories/utility)
4. /
5. firstphp/tower

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

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 3w 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

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

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

2384d 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/watcher

Hot reload watcher for Hyperf

17904.9k31](/packages/hyperf-watcher)[hyperf/crontab

A crontab component for Hyperf.

131.7M77](/packages/hyperf-crontab)[hyperf/socketio-server

Socket.io implementation for hyperf

26140.9k7](/packages/hyperf-socketio-server)[tangwei/dto

php hyperf dto

18138.4k3](/packages/tangwei-dto)

PHPackages © 2026

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