2.0.x-dev
2.0.9999999.9999999-devPHP class for the Dreamhost API
MIT
The Requires
The Development Requires
by Daniel Costa
Wallogit.com
2017 © Pedro Peláez
PHP class for the Dreamhost API
Interfaces with the Dreamhost API, (*1)
Package available on Composer. Autoloading is PSR-0 compatible., (*2)
<?php
use DanielCosta\Dreamhost;
$dh = new Dreamhost('your api key'[,format]);
$dh->exec('command'[, array(arg => value[, ...])]);
Where 'command' is one of the many listed on the Dreamhost Wiki API article., (*3)
Method 'exec' returns either an array of associative arrays of the data returned by Dreamhost or throws an exception upon error., (*4)
You can define any preferred return format by passing a second argument to class constructor. Defaults to 'json'., (*5)
<?php
use DanielCosta\Dreamhost;
$dh = new Dreamhost('6SHU5P2HLDAYECUM'[,format]);
try {
$method = 'api-list_accessible_cmds';
$commands = $dh->exec($method);
// $commands = $dh->$method(); // this should also work
print_r($commands);
} catch (Exception $e) {
echo $e->getMessage(); // contains either the error data returned by dreamhost or a curl error string and number
}
PHP class for the Dreamhost API
MIT