sapistudio/proxmox

2.0.3 2020-09-21 22:01 UTC

This package is auto-updated.

Last update: 2024-04-22 05:49:10 UTC


README

fork after : https://github.com/ZzAntares/ProxmoxVE.git

This PHP 5.4+ library allows you to interact with your Proxmox server via API.

Installation

Recommended installation is using [Composer], if you do not have [Composer] what are you waiting?

In the root of your project execute the following:

$ composer require sapistudio/proxmox

Usage

<?php

// Require the autoloader
require_once 'vendor/autoload.php';

// Use the library namespace
use SapiStudio\Proxmox\Handler;

// 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 = Handler::Nodes($credentials);

$allNodes = $proxmox->listNodes();

print_r($allNodes);

Sample output:

Array
(
    [data] => Array
        (
            [0] => Array
                (
                    [disk] => 2539465464
                    [cpu] => 0.031314446882002
                    [maxdisk] => 30805066770
                    [maxmem] => 175168446464
                    [node] => mynode1
                    [maxcpu] => 24
                    [level] =>
                    [uptime] => 139376
                    [id] => node/mynode1
                    [type] => node
                    [mem] => 20601992182
                )

        )

)

Access node id data

// set node id
$proxmox->setNodeId($noedName);
//and access nodeIddata
$proxmox->listNodeQemus();

License

This project is released under the MIT License. See the bundled [LICENSE] file for details.