Git Product home page Git Product logo

proxmoxve's Introduction

ProxmoxVE API Client

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

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

I'm not actively maintaining this library anymore (I've left PHP behind) but the API is pretty stable, if it doesn't suit your needs take a look at the forks or better yet create a PR to add the things you're missing, if you're interested I can transfer the project to you.

Looking for a PHP 5.3 library version? Search through the releases one that fits your needs, I recommend using the 2.1.1 version.

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 lumaserv/proxmoxve ~4.0.4

Or add this to your composer.json file:

{
    "require": {
        "lumaserv/proxmoxve": "~4.0.4"
    }
}

Then perform the installation:

$ composer install --no-dev

Usage

<?php

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

// Use the library namespace
use 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);

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
                )

        )

)

Want to know more nifty tricks?

Checkout our wiki.

License

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

=======

Want to contribute?

Thank you! Take a look at the CONTRIBUTING, you could easily set up a development environment to get you started in no time!

upstream/master [PVE2 API Documentation]:http://pve.proxmox.com/pve-docs/api-viewer/index.html [ProxmoxVE API]:http://pve.proxmox.com/wiki/Proxmox_VE_API [Proxmox wiki]:http://pve.proxmox.com/wiki [Composer]:https://getcomposer.org/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.