PHPackages                             moell/mojito - 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. [Admin Panels](/categories/admin)
4. /
5. moell/mojito

ActiveLibrary[Admin Panels](/categories/admin)

moell/mojito
============

Mojito admin is a component of laravel, vue, element build backend system.

v3.2.2(3y ago)49810.7k↓50%97MITPHPPHP ^7.2|^8.0

Since Oct 5Pushed 2y ago8 watchersCompare

[ Source](https://github.com/moell-peng/mojito)[ Packagist](https://packagist.org/packages/moell/mojito)[ RSS](/packages/moell-mojito/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (40)Used By (0)

Mojito
======

[](#mojito)

Mojito 是基于 Laravel 开发的 [Mojito Admin](https://github.com/moell-peng/mojito-admin) 的服务端。

3.0 版本开始， 已将原来的项目分离为两个代码库，分别为以Vue3、Element Plus、Vite 开发的前端模板 [mojito -admin](https://github.com/moell-peng/mojito-admin) 和服务端 [mojito](https://github.com/moell-peng/mojito) 。如果是需要使用 vue2 版本，请访问 [2.0](https://github.com/moell-peng/mojito/tree/2.0) 分支。

Mojito Admin 截图
---------------

[](#mojito-admin-截图)

[![mojito.png](https://camo.githubusercontent.com/3c011f70299b89f54524db50516555309c988ec7e533a3e8b9a2b1ff41ff22ac/687474703a2f2f7777312e73696e61696d672e636e2f6c617267652f3761363739636131677931677475303963346176656a32313539306b737464622e6a7067)](https://camo.githubusercontent.com/3c011f70299b89f54524db50516555309c988ec7e533a3e8b9a2b1ff41ff22ac/687474703a2f2f7777312e73696e61696d672e636e2f6c617267652f3761363739636131677931677475303963346176656a32313539306b737464622e6a7067)

特性
--

[](#特性)

- 前后端分离，提供 [Mojito Admin](https://github.com/moell-peng/mojito-admin) 前端模板
- 基于 laravel-permission 权限管理
- 基于 sanctum 鉴权
- 提供角色，权限，用户，菜单管理等功能的API
- 多个后台支持统一管理权限，菜单和角色
- 完善的PHPUnit测试

要求
--

[](#要求)

- Laravel &gt;= 7.0.0
- PHP &gt;= 7.2.0

安装
--

[](#安装)

首先安装laravel,并且确保你配置了正确的数据库连接。

```
composer require moell/mojito

```

然后运行下面的命令来发布资源:

```
php artisan mojito:install

```

命令执行成功会生成配置文件，数据迁移和构建SPA的文件。

修改 `app/Http/Kernel.php` ：

```
class Kernel extends HttpKernel
{
    protected $routeMiddleware = [
        ...
        'mojito.permission' => \Moell\Mojito\Http\Middleware\Authenticate::class,
    ];

    protected $middlewareGroups = [
            ...
            'api' => [
                ...
                \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
            ],
        ];
}

```

执行数据迁移，数据填充

```
php artisan migrate

php artisan db:seed --class="Moell\Mojito\Database\MojitoTableSeeder"

```

后台登录的账号 `admin` , 密码 `secret`

路由中间件
-----

[](#路由中间件)

- auth:sanctum 用于鉴权
- mojito.permission 权限验证

mojito.php 可选配置
---------------

[](#mojitophp-可选配置)

```
return [
    'guards' => [
        // laravel-permission 相对应的 guard
        'admin' => [
            'model' => \Moell\Mojito\Models\AdminUser::class, //登录鉴权的模型
            'login_fields' => [	// 登录验证的字段，支持多个
                'username',
            ],
            'conditions' => [ // 登录验证的额外条件
                ['status', '=', 1]
            ]
        ]
    ],
    'route_prefix' => "api", //路由前缀

    'middleware' => [
        'basic' => 'api', //基础中间件

        'auth' => ['auth:sanctum'], //鉴权中间件

        'permission' => ['auth:sanctum', 'mojito.permission'] //包含权限检测的中间件
    ]
];
```

依赖扩展包
-----

[](#依赖扩展包)

- spatie/laravel-permission
- laravel/sanctum

常见错误
----

[](#常见错误)

- csrf token missing or incorrect ， 请修改 sanctum.php 中的 `stateful` , 如 vite 使用的 `localhost:3000 `去除即可。更多详细请访问`laravel/sanctum`文档。

打赏
--

[](#打赏)

 [![](https://camo.githubusercontent.com/cf61aa7e0aeb17ab1b39fd0de31c6c2e48c7e1ab2ff492f00fb57386a4d1b3dc/687474703a2f2f7777312e73696e61696d672e636e2f6d773639302f37613637396361316c793166767872666e767861346a323064773064776469632e6a7067)](https://camo.githubusercontent.com/cf61aa7e0aeb17ab1b39fd0de31c6c2e48c7e1ab2ff492f00fb57386a4d1b3dc/687474703a2f2f7777312e73696e61696d672e636e2f6d773639302f37613637396361316c793166767872666e767861346a323064773064776469632e6a7067) [![](https://camo.githubusercontent.com/d8768ed4d42a5dd0f2f9144705f7fc3bee70a4b8516867e4b15d09a9b7771e06/687474703a2f2f7777312e73696e61696d672e636e2f6d773639302f37613637396361316c793166767872666e723064686a323064773064776770302e6a7067)](https://camo.githubusercontent.com/d8768ed4d42a5dd0f2f9144705f7fc3bee70a4b8516867e4b15d09a9b7771e06/687474703a2f2f7777312e73696e61696d672e636e2f6d773639302f37613637396361316c793166767872666e723064686a323064773064776770302e6a7067)

License
-------

[](#license)

Apache License Version 2.0 see

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity46

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 95.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 ~43 days

Recently: every ~93 days

Total

39

Last Release

1133d ago

Major Versions

v1.3.0 → v2.0.02020-07-04

v2.0.1 → v3.0.02021-08-26

v2.0.2 → v3.2.12022-08-02

PHP version history (3 changes)v1.0.0PHP &gt;=7.0.0

v1.2.0PHP ^7.2.0

v3.1.0PHP ^7.2|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/88bfbfdaec59d69edbb1697433f130ab2a5a66ae8897a63027a3d2ca396774d5?d=identicon)[moell](/maintainers/moell)

---

Top Contributors

[![moell-peng](https://avatars.githubusercontent.com/u/12830061?v=4)](https://github.com/moell-peng "moell-peng (65 commits)")[![eddiclin](https://avatars.githubusercontent.com/u/2800700?v=4)](https://github.com/eddiclin "eddiclin (1 commits)")[![samnela](https://avatars.githubusercontent.com/u/1852108?v=4)](https://github.com/samnela "samnela (1 commits)")[![Sy-Dante](https://avatars.githubusercontent.com/u/10508638?v=4)](https://github.com/Sy-Dante "Sy-Dante (1 commits)")

---

Tags

element-adminelement-plus-adminlaravel-adminlaravel-emement-plus-adminvue-adminlaraveladminlaravel-adminvueelementvue adminelement admin

### Embed Badge

![Health badge](/badges/moell-mojito/health.svg)

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

###  Alternatives

[moell/laravel-layui-admin

基于 Laravel, Layui 构建的 RBAC 后台管理系统。

662.8k](/packages/moell-laravel-layui-admin)[lokielse/laravel-admin-generator

An Admin Panel Generator for Laravel 5

712.0k](/packages/lokielse-laravel-admin-generator)[printnow/laravel-admin

Dcat admin 永久分叉版 / 支持 Laravel 12, PHP 版本限制 &gt;= 8.1（支持 PHP 8.4）

432.0k](/packages/printnow-laravel-admin)[larasnap/laravel-admin

Laravel Admin Panel

221.4k](/packages/larasnap-laravel-admin)

PHPackages © 2026

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