1. Go to this page and download the library: Download boudhraadhia7/vultr-php-sdk 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/ */
boudhraadhia7 / vultr-php-sdk example snippets
use BoudhraaDhia7\VultrLaravelSymfony\VultrAPI;
// Laravel: put these in config/services.php
// 'vultr' => [
// 'key' => env('VULTR_API_KEY'),
// 'url' => env('VULTR_API_URL', 'https://api.vultr.com/'),
// ]
// Production (TLS verify ON by default — recommended)
$vultr = new VultrAPI(config('services.vultr.key'), config('services.vultr.url'));
// Debug mode for more detailed response (false by default)
$debug = true;
// Localhost/dev with broken CA store (TLS verify OFF):
// ⚠️ Only for local testing. Never disable in production.
$devClient = new VultrAPI(config('services.vultr.key'), config('services.vultr.url'), false, $debug);
// List instances (auto adds Bearer & JSON headers; v2 paths)
$instances = $vultr->doCall('v2/instances', 'GET');
// List regions/plans
$regions = $vultr->doCall('v2/regions', 'GET');
$plans = $vultr->doCall('v2/plans', 'GET');
// Create a new server (example flow; adjust to your helpers)
$vultr->serverCreateDC('ewr'); // New Jersey (example)
$vultr->serverCreatePlan('vc2-1c-1gb'); // 1 vCPU, 1GB RAM (example)
$vultr->serverCreateType('OS', '1743'); // Ubuntu 22.04 (example)
$vultr->serverCreateLabel('My Laravel App');
$createResponse = $vultr->serverCreate(); // returns details/subid
// Manage an existing instance
$vultr->setSubId('YOUR_INSTANCE_ID');
$reboot = $vultr->doCall("v2/instances/{$vultr->getSubId()}/reboot", 'POST');
$halt = $vultr->doCall("v2/instances/{$vultr->getSubId()}/halt", 'POST');
$destroy = $vultr->doCall("v2/instances/{$vultr->getSubId()}", 'DELETE');
// Error handling
// On failures, doCall() returns an array with:
// - http_code
// - curl_errno / curl_error (transport issues => http_code = 0) // 'curl_errno' and 'curl_error' are PHP cURL terms
// - response_json / response_raw (Vultr often returns {"error": "..."} on 4xx)
### Laravel config snippet (for completeness) <!-- 'Laravel' is a PHP framework name -->
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.