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

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

ichong/tower
============

Hyperf之Tower开发组件

2.0.0(5y ago)0823↓56.3%1MITPHPPHP &gt;=7.2

Since Dec 20Pushed 5y agoCompare

[ Source](https://github.com/daxiong123/tower)[ Packagist](https://packagist.org/packages/ichong/tower)[ RSS](/packages/ichong-tower/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (6)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

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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 ~106 days

Total

5

Last Release

1915d ago

Major Versions

1.0.4 → 2.0.02021-02-19

### Community

Maintainers

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

---

Top Contributors

[![daxiong123](https://avatars.githubusercontent.com/u/2648157?v=4)](https://github.com/daxiong123 "daxiong123 (2 commits)")[![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/ichong-tower/health.svg)

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

###  Alternatives

[hyperf/watcher

Hot reload watcher for Hyperf

17846.7k27](/packages/hyperf-watcher)

PHPackages © 2026

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