test123test234 / sdk-php
This is an **example** API to demonstrate features of the OpenAPI specification. # Introduction This API definition is intended to to be a good starting point for describing your API in [OpenAPI/Swagger format](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md). It also demo
Requires
- php: ^8.1
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^1.7 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.5
- phpunit/phpunit: ^8.0 || ^9.0
README
Overview
This is an example API to demonstrate features of the OpenAPI specification. # Introduction This API definition is intended to to be a good starting point for describing your API in OpenAPI/Swagger format. It also demonstrates features of the create-openapi-repo tool and the Redoc documentation engine. Beyond the standard OpenAPI syntax, we use a few vendor extensions. # OpenAPI Specification The goal of The OpenAPI Specification is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, OpenAPI removes the guesswork in calling the service.
Installation
composer require test123test234/sdk-php
Configuration
<?php require_once('vendor/autoload.php'); use OpenAPI\Client\Configuration; use OpenAPI\Client\Api\BrandsApi; // Create configuration with API key $config = Configuration::getDefaultConfiguration() ->setApiKey('api-key', 'your_api_key_here'); // Create API client $apiInstance = new BrandsApi( new GuzzleHttp\Client(), $config );
Example Request
// Get brand data by domain try { $domainRequest = new OpenAPI\Client\Model\DomainRequest([ 'domain' => 'example.com' ]); $response = $apiInstance->byDomain($domainRequest); // Access brand data echo "Brand: " . $response->getBrand()->getName() . "\n"; echo "Logo: " . $response->getImages()->getLogos()[0]->getUrl() . "\n"; echo "Primary Color: " . $response->getColors()->getPrimary()[0]->getHex() . "\n"; } catch (Exception $e) { echo 'Exception: ', $e->getMessage(), PHP_EOL; }
API Endpoints
| Class | Method | Description |
|---|---|---|
| EchoApi | callEcho | Echo test |
Models
List of available API Models
Authentication
Authentication schemes defined for the API:
Example.com Authentication Documentation
api_key
- Type: API key
- API key parameter name: api_key
- Location: HTTP header