scrumptious/slagger
Composer 安装命令:
composer require scrumptious/slagger
包简介
Slim middleware for generating Swagger json for use with Swagger UI
README 文档
README
A Slim PHP middleware for generating swagger json for use with Swagger UI. This middleware will automatically add swagger json endpoints for all your Swagger doc annotated classes. Uses Zircote Swagger-php to parse annotations.
Install Using Composer
{
"require": {
"scrumptious\slagger": "0.3.0"
}
}
Usage
$app = new \Slim\Slim(); // Inject as Slim application middleware $app->add(new \Slagger\Slagger('/api/v1/docs', __DIR__.'/../lib')); \\ ... your app code $app->run();
You'd then input the url http://yourapidomain.com/api/v1/docs in the Swagger-UI interface.
Slagger(docsuri, scandir, options)
The constructor takes up to three arguments.
####docsuri The uri in your app that will return swagger json.
####scandir The directory to scan for files with Swagger annotations.
####options [optional] Options passed through to the getResource function of the Zircote swagger-php library.
Annotations
The Zircote Swagger-php library will parse the Swagger annotations in your files. See the Swagger-php docs for what annotations are supported.
ex:
/** * @SWG\Resource( * apiVersion="0.1", * swaggerVersion="1.2", * resourcePath="/journey", * basePath="http://myapi.com/api/v1" * ) */ class Journey extends CRUD { // ... }
统计信息
- 总下载量: 1.22k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-03-19