1. Go to this page and download the library: Download vultr/vultr-php 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/ */
vultr / vultr-php example snippets
declare(strict_types=1);
lient::create('Your Lovely Vultr API Key');
declare(strict_types=1);
Psr7\HttpFactory();
$client = Vultr\VultrPhp\VultrClient::create('Heres my api key', new GuzzleHttp\Client(), $http_factory, $http_factory);
declare(strict_types=1);
lient::create('Your Lovely Vultr API Key');
$options = new Vultr\VultrPhp\Util\ListOptions();
// Or
// $options = null;
/**
* Whether you pass in a null $options or a ListOptions. You can always expect to have ListOptions be passed back out too you when calling the function.
*/
while (true)
{
$instances = [];
foreach ($client->instances->getInstances(null, $options) as $instance)
{
$instances[] = $instance;
}
// Exit our loop, we have reached the end. Hooray!
if ($options->getNextCursor() == '')
{
break;
}
// Setting the "CurrentCursor" will tell the client which page it should transcode the url to make the request too.
$options->setCurrentCursor($options->getNextCursor());
}