sunfoxcz/redfish-client
Composer 安装命令:
composer require sunfoxcz/redfish-client
包简介
PHP client for IPMI/Redfish API communication
README 文档
README
PHP client for IPMI/Redfish API communication.
Installation
composer require sunfox/redfish-client
Usage
use Sunfox\RedfishClient\Client; $client = new Client( baseUrl: "https://192.168.x.x", username: "ADMIN", password: "password", timeout: 3.0, verifySsl: false, ); // Get power state $powerState = $client->getPowerState(); if ($powerState->isOn()) { echo "Server is ON\n"; } // Get power consumption $consumption = $client->getPowerConsumption(); echo "Current power: {$consumption->currentWatts}W\n"; // Get system info $systemInfo = $client->getSystemInfo(); echo "Manufacturer: {$systemInfo->manufacturer}\n"; echo "Model: {$systemInfo->model}\n"; // Check if reachable if ($client->isReachable()) { echo "Server is reachable\n"; }
Exception Handling
use Sunfox\RedfishClient\Exception\AuthenticationException; use Sunfox\RedfishClient\Exception\ConnectionException; use Sunfox\RedfishClient\Exception\RedfishException; try { $powerState = $client->getPowerState(); } catch (AuthenticationException $e) { echo "Invalid credentials\n"; } catch (ConnectionException $e) { echo "Cannot connect to server\n"; } catch (RedfishException $e) { echo "Redfish API error: {$e->getMessage()}\n"; }
License
MIT License. See LICENSE for details.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-30