PHPackages                             toshcn/yii2-ant-menu - 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. toshcn/yii2-ant-menu

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

toshcn/yii2-ant-menu
====================

一个为ant design 设计的菜单组件

1.0.x-dev(7y ago)08MITPHP

Since Jul 27Pushed 7y ago1 watchersCompare

[ Source](https://github.com/toshcn/yii2-ant-menu)[ Packagist](https://packagist.org/packages/toshcn/yii2-ant-menu)[ RSS](/packages/toshcn-yii2-ant-menu/feed)WikiDiscussions master Synced yesterday

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

ant menu component
==================

[](#ant-menu-component)

一个为ant design 设计的菜单组件

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist toshcn/yii2-ant-menu "*"

```

or add

```
"toshcn/yii2-ant-menu": "*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

配置应用组件:如common-&gt;config-&gt;main.php

```
'components' => [
    'menuManager' => [
        'class' => 'toshcn\yii2\menu\MenuManager',
        'cache' = 'cache',
        'cacheKey' => 'menu_cache_key',
        'expire' => 3600,
        'userTable' => '{{%user}}',
        'superAdminGroupId' => 1
    ],
]
```

配置命令行: 基础模板在config-&gt;console.php，高级模板在console-&gt;config-&gt;main.php

```
'controllerMap' => [
    'menu' => [
        'class' => 'toshcn\yii2\menu\commands\Menu',
    ],
],
```

运行数据迁移：

```
php yii migrate --migrationPath=@vendor/toshcn/yii2-ant-menu/src/migrations

```

为用户表添加`group_id`字段

```
php yii menu/add-user-group-id-column

```

添加一个用户组：

```
Yii::$app->menuManager->addGroup('user', '用户组说明：普通用户组');

```

添加一个菜单：

```
$parentId = 0;
Yii::$app->menuManager->addMenu('menu_name', 'path', $parentId, 'icon');

```

给用户组分配一个菜单：

```
$menuId = 1;
$groupId = 1;
Yii::$app->menuManger->assignMenu($menuId, $groupId);

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

Unknown

Total

1

Last Release

2847d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

menuyii2extension

### Embed Badge

![Health badge](/badges/toshcn-yii2-ant-menu/health.svg)

```
[![Health](https://phpackages.com/badges/toshcn-yii2-ant-menu/health.svg)](https://phpackages.com/packages/toshcn-yii2-ant-menu)
```

###  Alternatives

[kartik-v/yii2-widget-sidenav

An enhanced side navigation menu styled for bootstrap (sub repo split from yii2-widgets)

364.0M8](/packages/kartik-v-yii2-widget-sidenav)[kartik-v/yii2-nav-x

An extended bootstrap Nav widget for Yii 2 with submenu drilldown.

27564.8k6](/packages/kartik-v-yii2-nav-x)[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1357.2k7](/packages/richardfan1126-yii2-js-register)

PHPackages © 2026

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