PHP Classes


Recommend this page to a friend!
  Classes of Daniel Costa   Dreamhost   Download  
Role: Documentation
Content type: text/plain
Description: Documentation
Class: Dreamhost
Manage Dreamhost hosting accounts using its API
Author: By
Last change: Update of
Date: 4 days ago
Size: 1,454 bytes


Class file image Download
PHP class for the Dreamhost API [![Build Status](]( =============================== Interfaces with the Dreamhost API Installation ------------ Package available on [Composer]( Autoloading is [PSR-0]( compatible. Usage ----- <?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. Method *__'exec'__* returns either an array of associative arrays of the data returned by Dreamhost or throws an exception upon error. You can define any preferred return format by passing a second argument to class constructor. Defaults to 'json'. Example ------- <?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 }