PHPackages                             janfish/auth - 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. janfish/auth

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

janfish/auth
============

http auth

v1.0.3(4y ago)027MITPHPPHP &gt;=7.1.0

Since May 13Pushed 4y ago1 watchersCompare

[ Source](https://github.com/zeng444/janfish-auth)[ Packagist](https://packagist.org/packages/janfish/auth)[ RSS](/packages/janfish-auth/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (4)Used By (0)

### 认证组件

[](#认证组件)

#### JWT

[](#jwt)

```
$auth = Janfish\Auth\Auth::getInstance([
    'class' => MyIdentity::class,
    'type' => 'jwt',
    'setting' => [
        'alg' => 'HS256',
        'secret' => '123123123',
     ],
]);
$token = $auth->generateToken(1, ['name' => 'username']);

try{
    if ($auth->authorize($token) === false) {
        echo '失败';
        die();
    }
    print_r([
        $auth->getIdentity(),
        $auth->getExtendedData(),
    ]);
}catch (\Janfish\Auth\Exception\ExpiredException $e){
     echo '超时了' . PHP_EOL;
     die();
}catch (\Exception $e){
     echo '失败ma' . PHP_EOL;
     die();
}

```

#### Basic

[](#basic)

```
$auth = Janfish\Auth\Auth::getInstance([
    'class' => MyIdentity::class,
    'type' => 'basic'
]);
$token = $auth->generateToken('zeng444', 'password');
if ($auth->authorize($token) === false) {
    echo '失败';
    die();
}
print_r([
    $auth->getIdentity(),
    $auth->getExtendedData(),
]);

```

#### Reset

[](#reset)

```
$auth = Janfish\Auth\Auth::getInstance([
    'class' => MyIdentity::class,
    'type' => 'basic'
]);
$auth->reset();

```

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Total

3

Last Release

1807d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/60a62fd9f299f25558ac4a898ae3833bd7185ba4706bb167a8cabf05a3d96955?d=identicon)[Robert Zeng](/maintainers/Robert%20Zeng)

---

Top Contributors

[![zeng444](https://avatars.githubusercontent.com/u/941266?v=4)](https://github.com/zeng444 "zeng444 (10 commits)")

### Embed Badge

![Health badge](/badges/janfish-auth/health.svg)

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

###  Alternatives

[google/auth

Google Auth Library for PHP

1.4k272.7M161](/packages/google-auth)[thenetworg/oauth2-azure

Azure Active Directory OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2509.6M47](/packages/thenetworg-oauth2-azure)[stevenmaguire/oauth2-keycloak

Keycloak OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2275.9M27](/packages/stevenmaguire-oauth2-keycloak)[robsontenorio/laravel-keycloak-guard

🔑 Simple Keycloak Guard for Laravel

5161.1M3](/packages/robsontenorio-laravel-keycloak-guard)[patrickbussmann/oauth2-apple

Sign in with Apple OAuth 2.0 Client Provider for The PHP League OAuth2-Client

1132.5M6](/packages/patrickbussmann-oauth2-apple)[wp-graphql/wp-graphql-jwt-authentication

JWT Authentication for WPGraphQL

361118.4k1](/packages/wp-graphql-wp-graphql-jwt-authentication)

PHPackages © 2026

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