PHPackages                             keepxin/token - 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. keepxin/token

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

keepxin/token
=============

A Token SDK

1.0.1(7y ago)014MITPHP

Since Oct 31Pushed 7y agoCompare

[ Source](https://github.com/KeepXin/Token)[ Packagist](https://packagist.org/packages/keepxin/token)[ RSS](/packages/keepxin-token/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

 token
=======

[](#-token-)

 A Token SDK.

Installing
----------

[](#installing)

```
$ composer require keepxin/token -vvv
```

Usage
-----

[](#usage)

```
CREATE TABLE `api_token` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `app_id` int(11) NOT NULL COMMENT 'app_id',
  `user_id` int(11) NOT NULL COMMENT '用户id',
  `access_token` char(32) COLLATE utf8_unicode_ci NOT NULL COMMENT 'access_token值',
  `access_token_expires` int(11) NOT NULL COMMENT 'access_token有效期',
  `refresh_token` char(32) COLLATE utf8_unicode_ci NOT NULL COMMENT 'refresh_token值',
  `refresh_token_expires` int(11) NOT NULL COMMENT 'refresh_token有效期',
  `created_at` int(11) NOT NULL COMMENT '创建时间',
  `updated_at` int(11) NOT NULL COMMENT '修改时间',
  `platform` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '平台参数',
  `access_secret` varchar(100) COLLATE utf8_unicode_ci NOT NULL COMMENT '用户访问加密秘钥',
  PRIMARY KEY (`id`),
  KEY `api_token_user_id_index` (`user_id`),
  KEY `api_token_access_token_index` (`access_token`)
) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
```

```
 try{
            $result = Token::getToken(1, 1, 'pc');
        }catch (\Exception $exception){
            $message = $exception->getMessage();
            if ($exception instanceof \KeepXin\Token\Exceptions\InvalidConfigException) {
                $message = '参数配置错误'.$message;
            } else if ($exception instanceof \KeepXin\Token\Exceptions\ErrorDbException) {
                $message = '数据库操作失败'.$message;
            }
            dd($message);
        }
```

Contributing
------------

[](#contributing)

You can contribute in one of three ways:

1. File bug reports using the [issue tracker](https://github.com/keepxin/token/issues).
2. Answer questions or fix bugs on the [issue tracker](https://github.com/keepxin/token/issues).
3. Contribute new features or update the wiki.

*The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.*

License
-------

[](#license)

MIT

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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 ~0 days

Total

2

Last Release

2752d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0da93425155d206043d645836e148e5d37004ebeacba59386c4456143111a4be?d=identicon)[KeepXin](/maintainers/KeepXin)

---

Top Contributors

[![KeepXin](https://avatars.githubusercontent.com/u/44629449?v=4)](https://github.com/KeepXin "KeepXin (1 commits)")

### Embed Badge

![Health badge](/badges/keepxin-token/health.svg)

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

PHPackages © 2026

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