freefri/cake-rest-api
最新稳定版本:0.7.22
Composer 安装命令:
composer require freefri/cake-rest-api
包简介
CakePHP Rest API
README 文档
README
Rest API for CakePHP 5.x
Configuration
-
Some configuration can be done using env variables (search for
env(in the project to find usages). -
Some configuration when working with plugins can be done from the main configuration (
config/app.phpfile).- Using the key
Swaggeris optional, but can be helpful to customize some directories (search forread('Swaggerfor details) - As sibling from the main
Appconfiguration use the namespace of the plugin followed by the wordPlugin.
- Using the key
For example, if your plugin namespace is called Example, create the following config file:
return [
'debug' => false,
'App' => [ ... ],
'Swagger' => [ ... ]
'ExamplePlugin' => [
'tablePrefix' => 'example_',
'routePath' => '/api/v1',
],
];
The following configuration can be used:
tablePrefix: (optional) in case you want to add a prefix for you database tables, e.g.myplugin_users. Can be empty string.routePath: Definition for the beginning of the path for all routes in the plugin
Swagger
In order to make swagger UI with openapi description available, a new controller SwaggerJsonController must be
created, with the corresponding route definition. The method getContent can be overwritten in this controller
in order to add customization for the main spec info (title, description, version, etc.). Swagger generation can be
configured as described in the Configuration section above.
In any controller test the function $this->skipNextRequestInSwagger() can be used to do not add the next request.
License
The source code for the site is licensed under the MIT license, which you can find in the LICENSE file.
统计信息
- 总下载量: 4.92k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 12
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-01-13