bedezign / laravel-openapi-consumer
Laravel component to load an OpenAPIY JSON file and assist in consuming the underlying API.
Installs: 24
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 5
Forks: 1
Open Issues: 0
Type:laravel-extension
Requires
- php: >=5.6.0
- guzzlehttp/guzzle: ~6.0
This package is not auto-updated.
Last update: 2024-11-09 20:12:27 UTC
README
PoC to see if it is possible to automatically consume an API that has an OpenAPI specification (pka Swagger).
At this point the library is written for laravel.
If you need to use it, simply create a Client instance with the correct configuration
$api = new \OpenAPI\Consumer\Client('json specification path', [<extra configuration>])
You can then call any operation from the API in a very simplistic way:
$call = $api->operationName->with(['api-data' => 'api-data-value'])->execute();
if ($call->statusCode == 200) {
dd($call->json);
}