PHPackages                             hwl/thinkphp-controllers-to-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. hwl/thinkphp-controllers-to-menu

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

hwl/thinkphp-controllers-to-menu
================================

thinkphp controllers DOC block to menu array

1.0.0(10y ago)123Apache2PHPPHP &gt;=5.3.0

Since Sep 24Pushed 10y ago1 watchersCompare

[ Source](https://github.com/webberwong/PHP-Tp-Controllers-To-Menu)[ Packagist](https://packagist.org/packages/hwl/thinkphp-controllers-to-menu)[ RSS](/packages/hwl-thinkphp-controllers-to-menu/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Thinkphp 控制器转为菜单数组类库
====================

[](#thinkphp-控制器转为菜单数组类库)

根据Thinkphp控制器里写的注释来转为菜单数组,供后台功能菜单使用.
只适用于 *Thinkphp 3.2* 版本

### 安装

[](#安装)

```
#下载依赖的库并自动生成composer的自动加载类
composer require hwl/thinkphp-controllers-to-menu

```

使用说明
----

[](#使用说明)

一般是针对于后台,就使用默认的配置就行,初始化的时候,传入项目文件夹的路径即可

#### 简单示例

[](#简单示例)

```
//加入命名空间
use Hwl\ThinkphpControllersToMenu\ControllersToMenu;

$controllerFolderPath = __DIR__ . '/Controller';
//初始化并赋值上路径
$ctm  = new ControllersToMenu($controllerFolderPath);

//获取菜单
$menu = $ctm->getMenu();
```

#### 更改命名空间,即不是默认的Admin项目

[](#更改命名空间即不是默认的admin项目)

默认的命名空间是Admin\\Controller

```
//更改命名空间,注意反斜杠的转义,命名空间的形式
$ctm->setNamespace('Home\\Controller\\');
$menu = $ctm->getMenu();
```

#### 未测试的功能

[](#未测试的功能)

这些功能是以前以前的版本有设计该功能,并通过测试的,但在该版本里,是保留,未进行测试的
功能列表:

- 设置过滤的类

```
    //该版本已经增加的在注释里进行过滤,但由于继承的父类,所以仍保留这个功能,未进行测试
    /**
     * 设置过滤的类名(菜单栏)
     * @param string $className
     */
    $ctm->setNotClass($className);
```

- 设置过滤的类及方法

```
    //该版本已经增加的在注释里进行过滤,但由于继承的父类及父类的方法,所以仍保留这个功能,未进行测试
    /**
     * 设置过滤的类名及方法
     * @param string $className  类名
     * @param array  $methods    方法名称数组,如何为空数组,则表示过滤整个类 array('methodName','methodName')
     */
    $ctm->setNotClassMethod($className,$methods = array());
```

其他的请查看代码文件

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

3890d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b98ea97f1c1d7f3605aa467d63c69074a5560d152171fbca0e4ec1733cbd696?d=identicon)[williamWong](/maintainers/williamWong)

---

Top Contributors

[![webberwong](https://avatars.githubusercontent.com/u/8621886?v=4)](https://github.com/webberwong "webberwong (2 commits)")

---

Tags

phpthinkphp

### Embed Badge

![Health badge](/badges/hwl-thinkphp-controllers-to-menu/health.svg)

```
[![Health](https://phpackages.com/badges/hwl-thinkphp-controllers-to-menu/health.svg)](https://phpackages.com/packages/hwl-thinkphp-controllers-to-menu)
```

###  Alternatives

[xiaodi/think-pullword

ThinkPHP 分词/抽词 扩展包

5512.1k](/packages/xiaodi-think-pullword)[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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