iramgutierrez/lumen-resource-api

为Lumen 5.3创建资源API:实体、仓库、管理器、验证器、控制器、迁移、表、路由和文档

1.3.4 2016-11-14 18:52 UTC

This package is not auto-updated.

Last update: 2024-09-23 15:16:19 UTC


README

Software License

Total Downloads

API RESTful全资源生成器

此包实现了层模式设计,包括

  • 实体
  • 控制器
  • 管理器
  • 验证器
  • 仓库
  • 迁移
  • 路由
  • 文档(需要安装apidocjs

安装

将以下行添加到您的composer.json文件中

"iramgutierrez/lumen-resource-api": "1.3.*"

运行composer update以获取该包。

一旦composer安装了该包,请将以下行代码添加到您的bootstrap/app.php文件中

$app->register(\IramGutierrez\API\APIServiceProvider::class);

迁移和配置发布

将以下代码行添加到您的app/Console/Kernel.php文件中的受保护的$commands数组中

\Laravelista\LumenVendorPublish\VendorPublishCommand::class

运行php artisan vendor:publish以发布此包配置和迁移。之后,您可以编辑config/resource_api.php文件以设置生成的资源的命名空间。

运行迁移以创建所需的表

php artisan migrate

用法

现在,您应该有可用的Artisan命令:create-resource-api,可以使用如下方式使用

php artisan create-resource-api {Entity}

示例

运行

php artisan create-resource-api Test

然后,命令会询问您表名

Table name [tests]:

命名空间

Path name [API]:

路由前缀

Prefix route []:

是否生成文档

Generate documentation? (Require apidocjs) (yes/no) [yes]:

是否生成迁移文件

Generate migration? (yes/no) [yes]:

是否运行迁移

Run migration? (yes/no) [yes]:

是否在routes.php文件中添加路由资源

Add routes resource? (yes/no) [yes]:

是否添加中间件

Middlewares or middleware groups (comma separated) []:

执行完成后,您应该有以下可用功能路由

许可证

Lumen Resource API包在MIT许可证下发布。