smillerdev / phpdraft
这是一个用于处理PHP API Blueprint文件的解析器。
2.5.2
2023-08-04 09:20 UTC
Requires
- php: ^8.1
- ext-curl: *
- ext-json: *
- lukasoppermann/http-status: ~4.0
- matthiasmullie/minify: ^1.3
- michelf/php-markdown: ~2.0
- ql/uri-template: ~1.0
- twig/markdown-extra: ^3.0
- twig/twig: ^3.0
- vanilla/garden-cli: ~4.0
Requires (Dev)
- lunr/halo: dev-master
- phing/phing: ~2.0
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^1.2.0
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-phpunit: ^1.0.0
- phpstan/phpstan-strict-rules: ^1.5
- phpunit/phpunit: ~10.2
- theseer/autoload: ~1.0
- dev-main
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4.2
- 2.4.1
- 2.4.0.2
- 2.4.0.1
- 2.4.0
- 2.4.0-rc6
- 2.4.0-rc5
- 2.4.0-rc4
- 2.4.0-rc3
- 2.4.0-rc2
- 2.4.0-rc1
- 2.3.0
- 2.2.1
- 2.2
- 2.1.1
- 2.1
- 2.0.1
- 2.0.0
- 1.15.10
- 1.15.9
- 1.15.8
- 1.15.7
- 1.15.6
- 1.15.5
- 1.15.4
- 1.15.3
- 1.15.2
- 1.15.1
- 1.15.0
- 1.14.1.2
- 1.14.1.1
- 1.14.1
- 1.14
- 1.13.3
- 1.13.2
- 1.13.1
- 1.13
- 1.12
- 1.11.1
- 1.11
- 1.10
- 1.9.2
- 1.9.1
- 1.9
- 1.9-beta.2
- 1.9-beta
- 1.8.3
- 1.8.2
- 1.8.1
- 1.8
- 1.7.1
- 1.7
- 1.6
- 1.5
- dev-dependabot/composer/phpstan/phpstan-strict-rules-1.6.1
- dev-dependabot/composer/phpstan/phpstan-1.12.4
- dev-dependabot/composer/lunr/halo-0.10.0
- dev-dependabot/composer/phpstan/phpstan-deprecation-rules-1.2.1
- dev-dependabot/composer/phpstan/phpstan-1.12.3
- dev-dependabot/composer/twig/markdown-extra-3.13.0
- dev-dependabot/composer/twig/twig-3.14.0
- dev-dependabot/composer/phpstan/extension-installer-1.4.3
- dev-dependabot/composer/rize/uri-template-0.3.8
- dev-feat/out/generate_openapi
- dev-dependabot/composer/lunr/halo-0.9.0
- dev-chore/php80
- dev-fix/phpstan/types
- dev-SMillerDev-patch-2
This package is auto-updated.
Last update: 2024-09-20 20:08:28 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 phar
或phing phar-nightly
库
此应用程序使用了以下库