Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mowangjuanzi/lumen-plus
lumen feature plus
https://github.com/mowangjuanzi/lumen-plus
Last synced: 6 days ago
JSON representation
lumen feature plus
- Host: GitHub
- URL: https://github.com/mowangjuanzi/lumen-plus
- Owner: mowangjuanzi
- License: mit
- Created: 2020-02-24T23:52:21.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-09-07T22:32:39.000Z (about 3 years ago)
- Last Synced: 2024-04-19T00:23:06.680Z (7 months ago)
- Language: PHP
- Size: 24.4 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lumen-plus
lumen feature plus## 简介
本组件是作为 Lumen 框架服务的增强
## 功能
1. 替换 `nikic/fast-route` 为 `illuminate/routing`
2. 新增以下 `make` 命令
- `make:controller`
- `make:model`
- `make:factory`
- `make:middleware`
- `make:command`
- `event:generate`
- `make:event`
- `make:resource`3. 新增路由缓存命令
- `router:cache`
- `router:clear`## 安装
执行以下命令
```bash
composer require mowangjuanzi/lumen-plus
```使用 `Mowangjuanzi\Plus\LumenPlusApplication` 替换 `bootstrap/app.php` 中的 `Laravel\Lumen\Application`, 即:
```php
$app = new Mowangjuanzi\Plus\LumenPlusApplication(
dirname(__DIR__)
);
```注册服务提供者
```php
$app->register(Mowangjuanzi\Plus\LumenServiceProvider::class);
```## 后续操作
**防止缓存文件被`git`追踪**
创建文件夹`bootstrap/cache`,然后创建`bootstrap/cache/.gitignore`,输入以下内容
```gitignore
*
!.gitignore
```**加载路由**
接下来修改`bootstrap/app.php` 中加载路由的地方。
框架最开始是这样的:
```php
$app->router->group([
'namespace' => 'App\Http\Controllers',
], function ($router) {
require __DIR__.'/../routes/web.php';
});
```修改后变成这样:
```php
if ($app->files->exists($app->basePath("bootstrap/cache/routes.php"))) {
require_once $app->basePath("bootstrap/cache/routes.php");
} else {
$app->router->group([
'namespace' => 'App\Http\Controllers',
], function ($router) {
require __DIR__.'/../routes/web.php';
});
}
```## 命令执行和查看
然后我们就可以查看命令:
```bash
$ php artisan
Laravel Framework Lumen (6.3.3) (Laravel Components ^6.0)Usage:
command [options] [arguments]Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--env[=ENV] The environment the command should run under
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debugAvailable commands:
help Displays help for a command
list Lists commands
migrate Run the database migrations
route
route:cache Create a route cache file for faster route registration
route:clear Remove the route cache file
route:list List all registered routes
```缓存路由
```bash
php artisan router:cache
```清除路由
```bash
php artisan router:clear
```## 反馈
有什么问题可以来 issus.