Open a shell, cd
to your poject and type:
composer require malc0mn/vultr-api-client
or edit composer.json and add:
{
"require": {
"malc0mn/vultr-api-client": "~1.0"
}
}
If you want to use the GuzzleHttpAdapter
, you will need to add Guzzle 5
or Guzzle 6.
require 'vendor/autoload.php';
use Vultr\VultrClient;
use Vultr\Adapter\GuzzleHttpAdapter;
// Using Guzzle 5 or 6...
$client = new VultrClient(
new GuzzleHttpAdapter('your-api-key')
);
$result = $client->metaData()->getAccountInfo();
var_export($result);
require 'vendor/autoload.php';
use Vultr\VultrClient;
use Vultr\Adapter\CurlAdapter;
// Using regular CURL, courtesy of 'usefulz'
$client = new VultrClient(
new CurlAdapter('your-api-key')
);
$result = $client->metaData()->getAccountInfo();
var_export($result);
The full API documentation can be found on https://www.vultr.com/api and has been partly added to the PHP DocBlocks companioning the PHP functions that implement the actual calls.
The original version of this API is done by usefulz. This version has been forked by integr.io for use in one of our Symfony applications. It has been reworked with extensibility and ease of use in mind.