happycar/zf2-swagger-ui

此包已被弃用且不再维护。没有建议的替代包。

ZF2 - Swagger UI 模块

v1.0.1 2016-06-16 07:38 UTC

This package is not auto-updated.

Last update: 2020-08-14 01:43:18 UTC


README

License Total Downloads Latest Stable Version Latest Unstable Version

ZF2 模块,将默认的 Swagger-UI 封装成 ZF2 模块。

安装

推荐通过 composer 安装 happycar/zf2-swagger-ui,将依赖项添加到你的 composer.json 文件中。

{
    "require": {
        "happycar/zf2-swagger-ui": "*"
    }
}

此模块需要一些配置,这些配置可以通过根项目定义。

因此,请将以下配置添加到你的 composer.json 文件中:

{
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "swagger-api/swagger-ui",
                "version": "2.1.4",
                "source": {
                    "url": "https://github.com/swagger-api/swagger-ui",
                    "type": "git",
                    "reference": "v2.1.4"
                }
            }
        }
    ]
}
{
    "scripts": {
        "post-update-cmd": [
            "cp -R ./vendor/swagger-api/swagger-ui/dist ./vendor/happycar/zf2-swagger-ui/public/swagger-ui",
            "cp ./vendor/swagger-api/swagger-ui/dist/index.html ./vendor/happycar/zf2-swagger-ui/view/swagger-ui/index/index.phtml",
            "sed -i -e 's,images/,/swagger-ui/images/,g' ./vendor/happycar/zf2-swagger-ui/view/swagger-ui/index/index.phtml",
            "sed -i -e 's,css/,/swagger-ui/css/,g' ./vendor/happycar/zf2-swagger-ui/view/swagger-ui/index/index.phtml",
            "sed -i -e 's,lib/,/swagger-ui/lib/,g' ./vendor/happycar/zf2-swagger-ui/view/swagger-ui/index/index.phtml",
            "sed -i -e 's,swagger-ui.js,/swagger-ui/swagger-ui.js,g' ./vendor/happycar/zf2-swagger-ui/view/swagger-ui/index/index.phtml"
        ]
    }
}

然后将模块添加到你的 application.config.php 文件中的模块数组中,添加 "SwaggerUI"

使用

将模块添加到你的应用配置后,你可以通过访问 /api 来访问 Swagger UI。

如何改进

创建 happycar/zf2-swagger-ui 的自己的分支。

为了分享你的更改,提交一个 pull request

变更日志

请参阅 发布日志

许可证

MIT 许可证 (MIT)

版权所有 © 2016 HAPPYCAR GmbH

特此授予任何获得此软件及其相关文档副本(“软件”)的个人,免费、不可撤销地使用软件的权利,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或出售软件副本,并允许软件的接受者为此目的而进行操作,前提是满足以下条件

上述版权声明和本许可声明应包含在软件的所有副本或主要部分中。

本软件按“现状”提供,不提供任何明示或暗示的保证,包括但不限于适销性、特定目的适用性和非侵权性保证。在任何情况下,作者或版权所有者均不对任何索赔、损害或其他责任负责,无论这些责任是因合同、侵权或其他原因引起的,无论是与软件或其使用或其它方式相关。