lehuizi / proxmoxve
A simple PHP 5.5+ Proxmox API client.
Installs: 2 007
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 1
Open Issues: 0
Requires
- php: >=5.5.0
- lib-curl: *
- guzzlehttp/guzzle: ^7.0.1
Requires (Dev)
- pestphp/pest: ^1.0
- phpunit/phpunit: ^9.3.3
- squizlabs/php_codesniffer: ^3.5
- wapmorgan/php-code-fixer: ^2.0
README
This PHP 7.2+ 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 lehuizi/proxmoxve
Or add this to your composer.json
file:
{ "require": { "lehuizi/proxmoxve": "~5.0" } }
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 Address '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', ]; // It is also possible to authenticate against your proxmox server using api tokens $credentials = [ 'hostname' => 'proxmox.server.com', 'username' => 'root', 'token_name' => 'mytoken', 'token_value' => '00000-00000-000000000000' ]; // Then simply pass your credentials when creating the API client object. $proxmox = new Proxmox($credentials); $nodes = $proxmox->get('/nodes'); print_r($nodes);
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 ) ) )
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!