PHPackages                             elapse-annals/laravel-plus - 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. [Framework](/categories/framework)
4. /
5. elapse-annals/laravel-plus

ActiveProject[Framework](/categories/framework)

elapse-annals/laravel-plus
==========================

The Laravel Framework.

7.0(5y ago)51139[22 PRs](https://github.com/elapse-annals/laravel-plus/pulls)Apache-2.0PHPPHP ^7.2.5

Since Jun 1Pushed 2y ago2 watchersCompare

[ Source](https://github.com/elapse-annals/laravel-plus)[ Packagist](https://packagist.org/packages/elapse-annals/laravel-plus)[ RSS](/packages/elapse-annals-laravel-plus/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (20)Versions (31)Used By (0)

English | [中文](README-ZH.md)

[![](https://camo.githubusercontent.com/640c3d52b2764f179ef3cf089b604516a8c4ac0a06f055a46c6a7fce9428b787/68747470733a2f2f6c61726176656c2e636f6d2f6173736574732f696d672f636f6d706f6e656e74732f6c6f676f2d6c61726176656c2e737667)](https://camo.githubusercontent.com/640c3d52b2764f179ef3cf089b604516a8c4ac0a06f055a46c6a7fce9428b787/68747470733a2f2f6c61726176656c2e636f6d2f6173736574732f696d672f636f6d706f6e656e74732f6c6f676f2d6c61726176656c2e737667)**plus**

[![php-badge](https://camo.githubusercontent.com/eed4d5cf01364b115489810f47ed4b33191d997e7ab4014f3daff1c09fbae7d9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e332d3838393242462e737667)](https://camo.githubusercontent.com/eed4d5cf01364b115489810f47ed4b33191d997e7ab4014f3daff1c09fbae7d9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e332d3838393242462e737667)[![laravel-badge](https://camo.githubusercontent.com/2a3c0391555ce6ad44bb97d08f629baec70ae72af666ab44ea2283eb9cbc5305/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2532302d253345253344382e31322d7265642e737667)](https://camo.githubusercontent.com/2a3c0391555ce6ad44bb97d08f629baec70ae72af666ab44ea2283eb9cbc5305/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2532302d253345253344382e31322d7265642e737667)[![Build Status](https://camo.githubusercontent.com/2331007c212a9d26b89e6e7369061b1bbee1d607f3eb573bced439cbfac06ff1/68747470733a2f2f7777772e7472617669732d63692e636f6d2f656c617073652d616e6e616c732f6c61726176656c2d706c75732e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/2331007c212a9d26b89e6e7369061b1bbee1d607f3eb573bced439cbfac06ff1/68747470733a2f2f7777772e7472617669732d63692e636f6d2f656c617073652d616e6e616c732f6c61726176656c2d706c75732e7376673f6272616e63683d6d6173746572)[![License](https://camo.githubusercontent.com/a9252a277dcf719ebb9bf390854f672125cc137fc54be0b3ad7078b03b816117/68747470733a2f2f706f7365722e707567782e6f72672f656c617073652d616e6e616c732f6c61726176656c2d706c75732f6c6963656e7365)](LICENSE)[![composer.lock](https://camo.githubusercontent.com/266a75fb8332646cff312e098815b46edf6ef17e24e459e58025f519b261e182/68747470733a2f2f706f7365722e707567782e6f72672f656c617073652d616e6e616c732f6c61726176656c2d706c75732f636f6d706f7365726c6f636b)](https://packagist.org/packages/elapse-annals/laravel-plus)

介绍
--

[](#介绍)

[LaravelPlus](https://github.com/ElapseAnnals/Laravel-plus) 基于 [Laravel](https://github.com/laravel/laravel)增加部分软件包初始安装和进行业务使用功能改动，来创建一个开箱即用的应用.

目的
--

[](#目的)

- 增加基于模型 CURD 生成工具
- 自动 Laravel 与 Vue/Element UI 基于基础模型的代码生成器。
- 环境配置切换

运行环境要求
------

[](#运行环境要求)

- PHP
- composer
- MySQL ｜ PgSQL

项目使用
----

[](#项目使用)

#### 0.配置镜像

[](#0配置镜像)

配置 composer aliyun 镜像

```
$ composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
```

#### 1.下载项目

[](#1下载项目)

```
$ git clone https://github.com/ElapseAnnals/laravel-plus.git
```

#### 2.创建新项目

[](#2创建新项目)

```
//  A.在当前目录运行自动复制脚本 （ 推荐）
// YourProject 需要创建的项目名
$ php LaravelPlus/create YourProject
```

#### 3.新项目初始化

[](#3新项目初始化)

```
$ cd YourProject //  进入 YourProject 项目中
$ composer update
$ php artisan make:framework init --init
```

##### 4。本地服务开启

[](#4本地服务开启)

```
php artisan serve
```

Tips：

##### 更新 YourProject 项目（插件有改动时在上级目录中使用）

[](#更新-yourproject-项目插件有改动时在上级目录中使用)

```
php LaravelPlus/update YourProject
```

---

功能使用说明
------

[](#功能使用说明)

##### 创建分层脚本和[资源映射:想法来源](https://learnku.com/docs/laravel/5.8/controllers/1296#resource-controllers)

[](#创建分层脚本和资源映射想法来源)

framework 脚本创建内容：

- Controller, Service, Repository 等文件和对应关联关系
- Route 资源路由增加
- Controller 中资源类型代码和模型数据处理

模型生成

```
php artisan code:models --table=table_name   // 指定表
php artisan code:models --connection=mysql  // 指定数据库连接
php artisan code:models --connection=mysql --table=table_name   // 指定连接和指定表
```

使用 framework 功能创建 CURL（Tmpls 是对应模型复数名称）

```
 $ php artisan make:framework Tmpls  // 创建分层结构（推荐）
 $ php artisan make:framework Tmpls --D // 删除分层结构
  $ php artisan make:framework Tmpls --F // 强制生成分层结构

```

效果图： [![image](https://github.com/ElapseAnnals/LaravelPlus/tree/master/storage/app/public/images/readme/frameworrk_index.png)](https://github.com/ElapseAnnals/LaravelPlus/tree/master/storage/app/public/images/readme/frameworrk_index.png)

Tips:

- 注意文件被其它服务占用问题，可进行重启尝试 （Failed to clear cache. Make sure you have the appropriate permissions.）
- 使用导出需要在 web.php 中 export 注册路由

##### 热切换配置使用（config/dynamic/）

[](#热切换配置使用configdynamic)

在 .env 中设置 ENABLE\_HOT\_SWITCHING=true 后，会在 AppServiceProvider 进行 dynamic 映射

使用方式:

```
