PHPackages                             sunjim/laravel-module - 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. sunjim/laravel-module

ActiveLibrary

sunjim/laravel-module
=====================

laravel modules

2.0.8(6y ago)075MITPHPPHP &gt;=7.2

Since Mar 21Pushed 6y ago1 watchersCompare

[ Source](https://github.com/sunjim/laravel-modules)[ Packagist](https://packagist.org/packages/sunjim/laravel-module)[ RSS](/packages/sunjim-laravel-module/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)DependenciesVersions (17)Used By (0)

说明
--

[](#说明)

- 这个是我在向老师那里拿的文件，他的好久都没看到更新了，所以自己更新了一下。

更新说明
----

[](#更新说明)

- 减少权限请求数据库
- 增加了缓存配置，减少数据库访问。
- 更新权限认证缓存
- 由于版本更新问题，composer.json 移除了laravel-modules 和 laravel-permission，请自行安装
- 优化了导航和侧边栏

更新介绍
----

[](#更新介绍)

**Laravel****laravel-modules**5.8^1.0.96.0^2.0.3组件介绍
----

[](#组件介绍)

通过使用模块来管理大型Laravel项目，模块就像一个laravel包非常方便的进行添加或移除。 laravel-modules 和 laravel-permission 组件的功能都可以正常使用

安装组件
----

[](#安装组件)

```
composer require sunjim/laravel-module
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="config"

```

配置 composer.json 设置自动加载目录

```
{
  "autoload": {
    "psr-4": {
      "App\\": "app/",
      "Modules\\": "Modules/"
    }
  }
}

```

创建模块
----

[](#创建模块)

下面的命令是安装 `Admin` 模块

```
php artisan hd:module Admin

```

创建模块会同时执行以下操作：

- 生成 `menus.php` 配置文件
- 生成 `permission.php` 权限文件

模块配置
----

[](#模块配置)

新建模块时系统会自动创建配置，一般情况下不需要执行以下命令生成配置文件（除组件添加新配置功能外）

```
php artisan hd:config Admin

```

- $data——配置数据
- $name——配置文件

后台菜单
----

[](#后台菜单)

系统会根据模块配置文件 `menus.php` 生成后台菜单项

当 menus.php 文件不存在时，执行 `php artisan hd:config Admin` 系统会为模块 Admin 创建菜单。

**获取菜单**

获取系统可使用的所有菜单，以集合形式返回数据。可用于后台显示菜单列表。

```
\HDModule::getMenus()

```

权限管理
----

[](#权限管理)

首先需要安装 [laravel-permission](https://github.com/spatie/laravel-permission#installation) 组件，安装方式在上面已经介绍。

### 创建权限配置

[](#创建权限配置)

系统根据 `Admin` 模块配置文件 `permission.php` 重新生成权限，执行以下命令会创建权限配置文件。

```
php artisan hd:permission Admin

```

不指定模块时生成所有模块的权限表

```
php artisan hd:permission

```

> 页面导航在配置文件中

```
'allow_navigate' =>['后台管理'=>'admin'],

```

License
-------

[](#license)

The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 55.6% 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 ~26 days

Recently: every ~48 days

Total

16

Last Release

2220d ago

Major Versions

1.0.9 → 2.0.02019-09-28

PHP version history (2 changes)1.0PHP ^7.1.3

2.0.0PHP &gt;=7.2

### Community

Maintainers

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

---

Top Contributors

[![sunchengnxiaiing](https://avatars.githubusercontent.com/u/258725720?v=4)](https://github.com/sunchengnxiaiing "sunchengnxiaiing (10 commits)")[![sunjim](https://avatars.githubusercontent.com/u/5642983?v=4)](https://github.com/sunjim "sunjim (8 commits)")

### Embed Badge

![Health badge](/badges/sunjim-laravel-module/health.svg)

```
[![Health](https://phpackages.com/badges/sunjim-laravel-module/health.svg)](https://phpackages.com/packages/sunjim-laravel-module)
```

PHPackages © 2026

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