michaelb / lumen-make
Lumen make 为 lumen 添加了更多 make 命令,用于处理任务、控制器、中间件等。
v1.0
2016-01-20 22:46 UTC
Requires
- laravel/lumen-framework: ~5.1
This package is not auto-updated.
Last update: 2024-09-18 19:01:51 UTC
README
为 lumen 构建的包,将大多数 Laravel 的 make 命令移植过来。适用于 lumen v5.1,但很可能会在 5.2 上也能工作。我还没有测试。如果有任何请求,请告诉我,或者你自己做并提交 pull request。
安装
只需在项目的根目录中运行以下命令
> composer require michaelb/lumen-make
// In bootstrap/app.php /* |-------------------------------------------------------------------------- | Register Service Providers |-------------------------------------------------------------------------- | | Here we will register all of the application's service providers which | are used to bind services into the container. Service providers are | totally optional, so you are not required to uncomment this line. | */ //$app->register(App\Providers\AppServiceProvider::class); $app->register(App\Providers\EventServiceProvider::class); $app->register(MichaelB\LumenMake\LumenMakeServiceProvider::class); // <- Add this
// Optionally, if you don't want it to affect load times in production, // you can load it conditionally if (env('APP_ENV') != 'production' || env('APP_ENV') == 'local') { $app->register(MichaelB\LumenMake\LumenMakeServiceProvider::class); }
命令
make:job {name}
- 在 Jobs/ 目录下创建一个新的任务类make:console {name}
- 在 Console/Commands/ 目录下创建一个新的控制台命令make:controller {name}
- 在 Http/Controllers/ 目录下创建一个新的 RESTful 控制器make:model {name}
- 在 / 目录下创建一个新的模型make:middleware {name}
- 在 Http/Middleware/ 目录下创建一个新的中间件类make:exception {name}
- 在 Exceptions/ 目录下创建一个新的异常类make:event {name}
- 在 Events/ 目录下创建一个新的事件类