vanengers/php-openapi-client-generator
最新稳定版本:v1.1.0
Composer 安装命令:
composer require vanengers/php-openapi-client-generator
包简介
Generate a PHP client for an OPENAPI specification
README 文档
README
Generate a PHP client for an OPENAPI specification
Installation
composer require --dev vanengers/php-openapi-client-generator
Usage
OPENAPI=http://127.0.0.1:8000/docs.json NAMESPACE=VendorName\\PackageName\\Generated OUTPUT_DIR=src/Generated ./bin/api-client-generator generate
Specify the openapi specifications JSON file
OPENAPI=http://127.0.0.1:8000/docs.json
Specify the namespace for the generated classes
NAMESPACE=VendorName\\PackageName\\Generated
Specify the output directory for the generated classes
OUTPUT_DIR=src/Generated
Run the generator
./bin/api-client-generator generate
Example client is generated; SampleClient.php
You will need to finish the implementation of the client yourself. This is for generation of the login methods, which may differ per API. And you will need to add the correct namespace to the generated classes. You can also add your own methods to save and retrieve a Saved Token.
public function login()
{ ... }
callable $saveToken = fn (string $token) => saveInterally($token);
This would result in these generated classes
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: mit
- 更新时间: 2023-10-24
