unikorp/kong-admin-api

Kong Admin Api for PHP Projects

v0.0.1-beta.1 2017-08-15 21:52 UTC

README

Documentation Build Status Code Coverage Scrutinizer Code Quality Dependency Status SensioLabsInsight

Installation

Step 1: Download the Library

Open a command console, enter your project directory and execute the following command to download the latest stable version of this library:

$ composer require "unikorp/kong-admin-api"

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Download a client implementation

If your project is not already using a client implementation, select one form the list of virtual packages php-http/client-implementation, and then download it.

For this example we are going to use php-http/guzzle6-adapter

$ composer require "php-http/guzzle6-adapter"

Usage

<?php

require_once('./vendor/autoload.php');

// configure KongAdminApi client
$configurator = new \Unikorp\KongAdminApi\Configurator();
$configurator->setBaseUri('http://example.com:8001/');

// create KongAdminApi client
$client = new \Unikorp\KongAdminApi\Client($configurator);

// retrieve node information
$response = $client->getNode('information')->retrieveNodeInformation();
$information = json_decode($response->getBody()->getContents(), true);

var_dump($information);