nacosvel/openapi
最新稳定版本:v1.0.0
Composer 安装命令:
composer require nacosvel/openapi
包简介
A lightweight OpenAPI HTTP kernel built on Guzzle, providing extensible request builders, endpoint chaining, and middleware pipelines.
README 文档
README
OpenAPI
A lightweight OpenAPI HTTP kernel built on Guzzle, providing extensible request builders, endpoint chaining, and middleware pipelines.
Table of Contents
Installation
You can install the package via Composer:
composer require nacosvel/openapi
Usage
Builder Initialization
use Nacosvel\OpenAPI\Builder; $instance = Builder::factory([ 'mchid' => '190000****', ], [ 'base_uri' => 'https://httpspot.dev/', ]);
Middleware Registration
use Nacosvel\OpenAPI\Middleware\Middleware; $instance->addMiddleware([ new Middleware($builder->getClientDecorator()->getConfig()), ]);
Synchronous Request
$response = $builder->chain('anything/{code}')->get([ 'query' => [ 'id' => 1, ], 'code' => rand(100000, 999999), ]); var_dump($response->getBody()->getContents());
Asynchronous Requests
use Psr\Http\Message\ResponseInterface; $response = $builder->anything->_code_->getAsync([ 'query' => [ 'id' => 1, ], 'code' => rand(100000, 999999), ])->then(function (ResponseInterface $response) { return $response->getBody()->getContents(); })->wait(); var_dump($response);
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Contributors
Thanks goes to these wonderful people:
Contributions of any kind are welcome!
License
Distributed under the MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-04