nicordev/openapi_phpdoc_generator
Composer 安装命令:
composer require nicordev/openapi_phpdoc_generator
包简介
Convert JSON content into OpenApi phpdoc block
README 文档
README
Generate OpenApi phpdoc from json content.
Installation
Here we assume that you have php installed locally under /usr/bin:
cp src/Shell/openapi_phpdoc_generator_command.php /usr/local/bin/openapi_phpdoc_generator # To copy the command into one of our $PATH directory
chmod +x src/Shell/openapi_phpdoc_generator_command.php /usr/local/bin # To be able to execute the script without adding php in front of the command name
Usage
In your terminal, run:
openapi_phpdoc_generator
Then you will get some explanation about how to use the command, like this:
[IS_IN_MIDDLE=1] php openapi_phpdoc_generator yourJsonFileHere [startingDepthLevelHere]
To use the OpenApiPhpdocGenerator class in your codebase, use:
use Nicordev\OpenApiPhpdocGenerator\OpenApiPhpdocGenerator;
$ourAwesomeDecodedJsonContent = file_get_contents($ourAwesomeDecodedJsonContentFilePath);
$openApiPhpdocGenerator = new OpenApiPhpdocGenerator();
$result = $openApiPhpdocGenerator->generate($ourDecodedJsonContent, $ourStartingDepthLevel, $isInMiddleOfExistingPhpDoc);
I wish you a happy phpdoc generation!
Test
To run the test suite:
composer installmake test
If you're a docker enthusiast and you don't have php installed locally, you can do this instead:
make composer-install-using-dockermake test-using-docker
PhpStan
I've also added PHPStan, you can use it using make commands.
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-02-22