sunfoxcz/redfish-client

PHP client for IPMI/Redfish API communication

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/sunfoxcz/redfish-client

dev-master 2026-01-30 10:58 UTC

This package is auto-updated.

Last update: 2026-01-30 11:10:48 UTC


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.