smillerdev/phpdraft

这是一个用于处理PHP API Blueprint文件的解析器。

资助包维护!
smillerdev

安装: 9,990

依赖关系: 0

建议者: 0

安全性: 0

星星: 38

关注者: 3

分支: 6

开放问题: 17

语言:HTML

2.5.2 2023-08-04 09:20 UTC

README

这是一个用于处理PHP API Blueprint文件的解析器。1

依赖项

PHPDraft需要安装drafter。有关安装详情,请参阅drafter页面。如果您不想安装drafter,可以在命令中传递-o使其使用https://api.apiblueprint.org/parser

用法

运行需要PHP 8.1+。单元测试需要runkit或uopz。直接使用时,可以运行

$ ./phpdraft.phar -f blueprint-file.apib > blueprint-webpage.html

您也可以先安装它

$ cp phpdraft.phar /usr/bin/phpdraft
$ chmod +x /usr/bin/phpdraft
$ phpdraft -f blueprint-file.apib > blueprint-webpage.html

额外功能

我们有一些有趣的东西,更多详情请查看wiki

编写API文档

使用API Blueprint语法编写API文档。您可以阅读其规范

以下是一个示例

FORMAT: 1A
HOST: https://api.example.com/v1

# Hello API

A simple API demo

# Group People

This section describes about the People

## Person [/people/{id}]

Represent particular Person

+ Parameters

    + id (required, string, `123`) ... The id of the Person.

+ Model (application/json)

    ```
    {"name":"Gesang","birthdate":"01-09-1917"}
    ```

### Retrieve Person [GET]

Return the information for the Person

+ Request (application/json)

    + Headers

        ```
        Authorization: Basic AbcdeFg=
        ```

+ Response 200 (application/json)

    [Person][]

构建可执行文件

使用composer安装二进制依赖项(composer install)。运行phing pharphing phar-nightly

此应用程序使用了以下库

许可证

FOSSA Status