PHPackages                             shen/satoken - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. shen/satoken

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

shen/satoken
============

Sa-Token for PHP: auth, permission, annotation guard, jwt/temp-token/sign/apikey

v0.1.0(3mo ago)12Apache-2.0PHPPHP ^8.2CI passing

Since Mar 18Pushed 3mo agoCompare

[ Source](https://github.com/qicaiy/satoken)[ Packagist](https://packagist.org/packages/shen/satoken)[ RSS](/packages/shen-satoken/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

satoken-php
===========

[](#satoken-php)

Sa-Token 的 PHP 复刻版（Composer 包形式）。

原版项目说明
------

[](#原版项目说明)

- 原版（Java）仓库：
- 本项目是对原版能力域的 PHP 复刻实现，不是原作者官方发布。

风险声明
----

[](#风险声明)

- 本项目主要由 AI 编写与迁移，虽然已有自动化测试覆盖，但**可能存在边界行为不稳定或与原版细节不一致**。
- 用于生产环境前，请结合你的业务进行完整回归测试与灰度验证。

当前复刻范围
------

[](#当前复刻范围)

- 登录认证、会话管理（Account/Token Session）
- 权限/角色鉴权、多账号体系
- 封禁、踢下线、二级认证（safe）
- 注解鉴权（PHP 8 Attributes + DocBlock）
- Router/Filter
- JWT、TempToken、Sign、ApiKey
- Http Basic / Digest
- OAuth2（授权码/密码/客户端凭证/隐式/刷新）
- SSO（Ticket + Sign）

详细完整性评估见：

- [docs/REPLICA\_PROGRESS.md](docs/REPLICA_PROGRESS.md)

安装
--

[](#安装)

```
composer require shen/satoken
```

使用文档
----

[](#使用文档)

- [docs/USAGE.md](docs/USAGE.md)

CI（GitHub Actions）
------------------

[](#cigithub-actions)

已提供自动测试工作流：

- [.github/workflows/phpunit.yml](.github/workflows/phpunit.yml)

触发条件：`push` / `pull_request` 到 `main`，以及手动触发。

本地测试
----

[](#本地测试)

```
composer test
```

当前结果：`18 tests, 47 assertions, all passed`。

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance82

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

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

Unknown

Total

1

Last Release

96d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/72614b5b6e97b44b9a272ef71acc64c319a27c6acf6b75cdd8f7834c3d61fdd0?d=identicon)[qicaiy](/maintainers/qicaiy)

---

Tags

jwtauthpermissionrbacannotationsatoken

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/shen-satoken/health.svg)

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

###  Alternatives

[ellaisys/aws-cognito

AWS Cognito package that allows Auth and other related features using the AWS SDK for PHP

121242.9k1](/packages/ellaisys-aws-cognito)[generationtux/jwt-artisan

JWT auth package for Laravel and Lumen

13953.4k](/packages/generationtux-jwt-artisan)[orchestra/auth

Auth Component for Orchestra Platform

22108.6k3](/packages/orchestra-auth)[swoft/auth

Auth component for swoft

117.2k1](/packages/swoft-auth)

PHPackages © 2026

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