PHP code example of cleaniquecoders / kong-admin-api
1. Go to this page and download the library: Download cleaniquecoders/kong-admin-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cleaniquecoders / kong-admin-api example snippets
use CleaniqueCoders\KongAdminApi\Configuration;
$configuration = new Configuration(
base: 'http://127.0.0.1:8000',
uri: 'admin-api',
apiKey: 'your-api-key',
keyName: 'api-key'
);
use CleaniqueCoders\KongAdminApi\Client;
use CleaniqueCoders\KongAdminApi\Connector;
$connector = new Connector($configuration);
$client = new Client($connector);
use CleaniqueCoders\KongAdminApi\Enums\Endpoint;
use CleaniqueCoders\KongAdminApi\Request;
$response = $client->send(
(new Request)
->setEndPoint(Endpoint::SERVICES)
->store([
'name' => 'example-service',
'url' => 'http://example.com'
])
);
print_r($response);