lehuizi / proxmoxve
一个简单的PHP 5.5+ Proxmox API客户端。
v5.0.1
2021-02-01 11:00 UTC
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
这个 PHP 7.2+ 库允许您通过API与您的Proxmox服务器交互。
安装
推荐使用Composer进行安装,如果您还没有Composer,您还在等什么?
在您项目的根目录下执行以下操作
$ composer require lehuizi/proxmoxve
或者将其添加到您的composer.json
文件中
{ "require": { "lehuizi/proxmoxve": "~5.0" } }
然后执行安装
$ composer install --no-dev
用法
<?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);
示例输出
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 ) ) )
许可证
本项目采用MIT许可证发布。有关详细信息,请参阅附带LICENSE文件。
=======
想要贡献吗?
谢谢!请查看CONTRIBUTING,您可以轻松设置开发环境,让您快速开始!