PHP code example of enterpriseve / eve2pve-api-php
1. Go to this page and download the library: Download enterpriseve/eve2pve-api-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/ */
enterpriseve / eve2pve-api-php example snippets
orsinvest\ProxmoxVE\Api\PveClient;
// connect to any node of the cluster, with an API token
$client = new PveClient('pve01', 8006);
$client->setApiToken('automation@pve!app=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee');
// GET /nodes/{node}/qemu/{vmid}/status/current
$result = $client->getNodes()->get('pve01')->getQemu()->get(100)->getStatus()->getCurrent()->vmStatus();
echo $result->isSuccessStatusCode()
? "VM {$result->getResponse()->data->vmid} is {$result->getResponse()->data->status}"
: "{$result->getStatusCode()} {$result->getReasonPhrase()}";
______ _ __
/ ____/___ __________(_)___ _ _____ _____/ /_
/ / / __ \/ ___/ ___/ / __ \ | / / _ \/ ___/ __/
/ /___/ /_/ / / (__ ) / / / / |/ / __(__ ) /_
\____/\____/_/ /____/_/_/ /_/|___/\___/____/\__/
Proxmox VE API Client for PHP (Made in Italy)
bash
composer