PHP code example of smalot / kong-api

1. Go to this page and download the library: Download smalot/kong-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/ */

    

smalot / kong-api example snippets


$factory = new \Smalot\Kong\ServiceFactory();
/** @var \Smalot\Kong\Services\Api $service */
$service = $factory->get('api');
$response = $service->create(
  [
    'name' => $name,
    'uris' => '/ping',
    'upstream_url' => 'http://ping/',
  ]
);
$api = $response->json();
var_dump($api);