PHPackages                             zhenmu/laravel-init-template - 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. zhenmu/laravel-init-template

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

zhenmu/laravel-init-template
============================

v2.0.8(4y ago)85641MITPHP

Since Feb 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/mouyong/laravel-init-template)[ Packagist](https://packagist.org/packages/zhenmu/laravel-init-template)[ RSS](/packages/zhenmu-laravel-init-template/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (7)Versions (13)Used By (0)

 laravel-init-template
=======================

[](#-laravel-init-template-)

 .

Installing
----------

[](#installing)

```
composer require zhenmu/laravel-init-template -vvv

php artisan vendor:publish --provider "ZhenMu\LaravelInitTemplate\Providers\AppServiceProvider"
```

Usage
-----

[](#usage)

### 项目

[](#项目)

- app.php

```
'name' => env('APP_NAME', 'Laravel'),
'env' => env('APP_ENV', 'production'),
'debug' => (bool) env('APP_DEBUG', false),
'url' => env('APP_URL', 'http://localhost'),
'timezone' => 'PRC',
'locale' => 'zh_CN',
'faker_locale' => 'zh_CN',

```

- .env

```
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=false
APP_URL=http://localhost

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=redis
CACHE_DRIVER=redis
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

```

### sql 日志

[](#sql-日志)

日志路径：storage/logs/mysql-logs/mysql.log

```
APP_SQL_LOG_ENABLE=true
```

### 控制器

[](#控制器)

```
 [
    'jwt-api' => [
        'driver' => 'jwt',
        'provider' => 'users',
    ],
],
```

- 模型配置，引入 JwtUserTrait;

```
use ZhenMu\LaravelInitTemplate\Traits\JwtUserTrait;

class Admin extends BaseModel
{
    use JwtUserTrait;
}
```

- 控制器配置，引入 JwtLoginControllerTrait;

```
use ZhenMu\LaravelInitTemplate\Traits\JwtLoginControllerTrait;

class AuthController extends Controller
{
    use JwtLoginControllerTrait;

    /**
     * Create a new AuthController instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('auth', ['except' => ['login']]);
    }
}
```

- 路由配置，添加登录相关路由

```
Route::prefix('auth')->middleware('auth')->group(function () {
    // 用户登录管理
    Route::post('login', [AuthController::class, 'login'])->withoutMiddleware(['auth']);
    Route::post('logout', [AuthController::class, 'logout']);
    Route::post('refresh', [AuthController::class, 'refresh']);
    Route::post('me', [AuthController::class, 'me']);
});
```

### 文件上传七牛

[](#文件上传七牛)

- 添加配置文件

```
return [
   'disks' => [
        //...
        'qiniu' => [
            'driver'  => 'qiniu',
            'domains' => [
                'default'   => env('QINIU_DOMAIN', 'xxxxx.com1.z0.glb.clouddn.com'), //你的七牛域名
                'https'     => env('QINIU_DOMAIN', 'dn-yourdomain.qbox.me'),         //你的HTTPS域名
                'custom'    => env('QINIU_DOMAIN', 'static.abc.com'),                //Useless 没啥用，请直接使用上面的 default 项
            ],
            'access_key'=> env('QINIU_ACCESS_KEY', 'xxxxxxxxxxxxxxxx'),  //AccessKey
            'secret_key'=> env('QINIU_SECRET_KEY', 'xxxxxxxxxxxxxxxx'),  //SecretKey
            'bucket'    => env('QINIU_BUCKET', 'xxxxxxxxxxxxxxxx'),  //Bucket名字
            'notify_url'=> env('QINIU_NOTIFY_URL', 'xxxxxxxxxxxxxxxx'),  //持久化处理回调地址
            'access'    => env('QINIU_ACCESS', 'public'),  //空间访问控制 public 或 private
//            'hotlink_prevention_key' => 'afc89ff8bd2axxxxxxxxxxxxxxbb', // CDN 时间戳防盗链的 key。 设置为 null 则不启用本功能。
//            'hotlink_prevention_key' => 'cbab68a279xxxxxxxxxxab509a', // 同上，备用
        ],
        //...
    ]
];
```

- 配置环境变量

```
# 七牛
QINIU_ACCESS_KEY=
QINIU_SECRET_KEY=
QINIU_BUCKET=
QINIU_DOMAIN=https://your.domain.com

```

### 部署

[](#部署)

```
git subtree add -P deploy/docker/ https://github.com/mouyong/docker-php.git master

# swoole 构建
cp deploy/docker/swoole/Dockerfile .
# 环境变量
cp deploy/docker/acm.sh .
# 定时任务
cp deploy/docker/crontab .

COMPOSER_MEMORY_LIMIT=-1 composer require swooletw/laravel-swoole -vvv

php artisan vendor:publish --tag=laravel-swoole
```

更新 `config/swoole_http.php` 配置文件

```
-    'host' => env('SWOOLE_HTTP_HOST', '127.0.0.1'),
-    'port' => env('SWOOLE_HTTP_PORT', '1215'),
+    'host' => env('SWOOLE_HTTP_HOST', '0.0.0.0'),
+    'port' => env('SWOOLE_HTTP_PORT', '80'),

    'instances' => [
-       //
+        'auth',
    ],

    'providers' => [
        Illuminate\Pagination\PaginationServiceProvider::class,
+        Dcat\Admin\AdminServiceProvider::class, // dact-admin
    ],
```

License
-------

[](#license)

MIT

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Total

11

Last Release

1633d ago

Major Versions

v1.1.0 → v2.0.02021-09-16

### Community

Maintainers

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

### Embed Badge

![Health badge](/badges/zhenmu-laravel-init-template/health.svg)

```
[![Health](https://phpackages.com/badges/zhenmu-laravel-init-template/health.svg)](https://phpackages.com/packages/zhenmu-laravel-init-template)
```

###  Alternatives

[symfony/expression-language

Provides an engine that can compile and evaluate expressions

2.8k223.4M1.9k](/packages/symfony-expression-language)[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k251.7M11.5k](/packages/symfony-framework-bundle)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[phlak/directory-lister

PHP directory lister

2.5k1.4k](/packages/phlak-directory-lister)[metamodels/core

MetaModels core

10156.4k67](/packages/metamodels-core)

PHPackages © 2026

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