nacosvel / openapi
A lightweight OpenAPI HTTP kernel built on Guzzle, providing extensible request builders, endpoint chaining, and middleware pipelines.
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/nacosvel/openapi
Requires
- php: ^8.0
- ext-curl: *
- ext-openssl: *
- guzzlehttp/guzzle: ^7.10
- guzzlehttp/uri-template: ^1.0
- nacosvel/support: ^2.0
Requires (Dev)
- code-lts/doctum: ^5.0
This package is auto-updated.
Last update: 2026-02-04 05:37:32 UTC
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.