1. Go to this page and download the library: Download rene-roscher/proxmoxve 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/ */
rene-roscher / proxmoxve example snippets
// Require the autoloader
e ProxmoxVE\Proxmox;
// Create your credentials array
$credentials = [
'hostname' => 'proxmox.server.com', // Also can be an IP
'username' => 'root',
'password' => 'secret',
];
// realm and port defaults to 'pam' and '8006' but you can specify them like so
$credentials = [
'hostname' => 'proxmox.server.com',
'username' => 'root',
'password' => 'secret',
'realm' => 'pve',
'port' => '9009',
];
// Then simply pass your credentials when creating the API client object.
$proxmox = new Proxmox($credentials);
$allNodes = $proxmox->get('/nodes');
print_r($allNodes);
// Once again r/autoload.php';
// Sample custom credentials class
class CustomCredentials
{
public function __construct($host, $user, $pass)
{
$this->hostname = $host;
$this->username = $user;
$this->password = $pass;
}
}
// Create ProxmoxVE instance by passing your custom credentials object
$credentials = new CustomCredentials('proxmox.server.com', 'root', 'secret');
$proxmox = new ProxmoxVE\Proxmox($credentials);
// Then you can use it, for example create a new user.
// Define params
$params = [
'userid' => 'new_user@pve', // Proxmox
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.