PHPackages                             liuxinyang/hyperf-admin - 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. liuxinyang/hyperf-admin

ActiveLibrary

liuxinyang/hyperf-admin
=======================

admin for hyperf

v1.0.17(10mo ago)051MITHTMLPHP &gt;=8.0

Since Jun 4Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/yangliuxin/hyperfAdmin)[ Packagist](https://packagist.org/packages/liuxinyang/hyperf-admin)[ RSS](/packages/liuxinyang-hyperf-admin/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (12)Versions (18)Used By (0)

hyperfAdmin
===========

[](#hyperfadmin)

admin for hyperf

### 使用方法

[](#使用方法)

#### 1、建立hyperf项目

[](#1建立hyperf项目)

#### 2、composer require liuxinyang/hyperf-admin

[](#2composer-require-liuxinyanghyperf-admin)

#### 3、php bin/hyperf.php vendor:publish liuxinyang/hyperf-admin

[](#3php-binhyperfphp-vendorpublish-liuxinyanghyperf-admin)

#### 4、php bin/hyperf.php admin:init

[](#4php-binhyperfphp-admininit)

#### 5、route.php 里填写如下路由

[](#5routephp-里填写如下路由)

```
Router::get('/admin', [\Liuxinyang\HyperfAdmin\Controller\Admin\IndexController::class, 'index'], ['middleware' => [\Liuxinyang\HyperfAdmin\Middleware\AuthMiddleware::class]]);
Router::get('/admin/', [\Liuxinyang\HyperfAdmin\Controller\Admin\IndexController::class, 'index'], ['middleware' => [\Liuxinyang\HyperfAdmin\Middleware\AuthMiddleware::class]]);

```

#### 6、后台首页统计部分

[](#6后台首页统计部分)

```
需记录访问请求日志
AdminStats::log($uri, $ip, $province, $city);

```

#### 7、方法级检测权限

[](#7方法级检测权限)

```
#[PermissionCheck('{slug}')]
或
if (!$this->checkPermission($user['id'], '{slug}')) {
    return $this->render->render('/admin/noauth', $this->bladeData);
}

```

#### 8、AppExceptionHandler设置

[](#8appexceptionhandler设置)

```
$path = ApplicationContext::getContainer()->get(RequestInterface::class)->getPathInfo();
if(str_starts_with($path, "/api/")){
    $this->stopPropagation();
    return $response->withHeader('Content-type', 'application/json')->withStatus($throwable->getCode())->withBody(new SwooleStream(json_encode(ServiceConstant::result($throwable->getCode(), $throwable->getMessage()), 320)));
} else {
    $bladeData = [];
    $this->stopPropagation();
    if($throwable->getCode() == 403){
        $session =  Context::get(SessionInterface::class);
        $userSession = $session->get("admin");
        if($userSession){
            $user = json_decode($userSession, true);
            $bladeData['user'] = $user;

            $menuDataList = AdminMenus::where('type', 1)->get()->toArray();
            foreach ($menuDataList as $key => $menu) {
                if ($menu['uri'] == '') {
                    $menuDataList[$key]['uri'] = '/admin/#';
                } elseif ($menu['uri'] == '/') {
                    $menuDataList[$key]['uri'] = '/admin';
                } else {
                    $menuDataList[$key]['uri'] = '/admin/' . $menu['uri'];
                }
                if (!self::hasPermission($user['id'], $menu['id'])) {
                    unset($menuDataList[$key]);
                }
            }

            $bladeData['menuDataList'] = TreeUtils::getTree($menuDataList);
            if(!$session->get('csrf_token')){
                $session->set('csrf_token', str_random(32));
            }
            $bladeData['_token'] = $session->get('csrf_token');
        }
        return ApplicationContext::getContainer()->get(RenderInterface::class)->render('admin/noauth', $bladeData);
    } else {
        return $response->withHeader('Server', 'Hyperf')->withStatus($throwable->getCode())->withBody(new SwooleStream($throwable->getMessage()));
    }
}

```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance53

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

Recently: every ~93 days

Total

17

Last Release

326d ago

### Community

Maintainers

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

---

Top Contributors

[![yangliuxin](https://avatars.githubusercontent.com/u/28886044?v=4)](https://github.com/yangliuxin "yangliuxin (53 commits)")

### Embed Badge

![Health badge](/badges/liuxinyang-hyperf-admin/health.svg)

```
[![Health](https://phpackages.com/badges/liuxinyang-hyperf-admin/health.svg)](https://phpackages.com/packages/liuxinyang-hyperf-admin)
```

###  Alternatives

[mineadmin/mineadmin

Quickly build a background management system for web applications

1.2k2.0k](/packages/mineadmin-mineadmin)[xmo/mine-core

mineadmin core package

1684.2k1](/packages/xmo-mine-core)

PHPackages © 2026

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