PHP Classes
elePHPant
Icontem

Dreamhost: Manage Dreamhost hosting accounts using its API

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2013-08-23 (2 years ago) RSS 2.0 feedNot yet rated by the usersTotal: 115 All time: 8,114 This week: 1,076Up
Version License PHP version Categories  
php-dreamhost 1.0.2BSD License5.3PHP 5, Web services, Hosting
Description Author  

This class can manage Dreamhost hosting accounts using its API.

It can send HTTP requests to the Dreamhost API Web servers to execute all types of commands that it supports like managing hosting accounts, manage domains and DNS records, email, MySQL, etc..

The class decodes and returns the response to the Dreamhost API requests. API call errors make the class throw exceptions.

Picture of Daniel Costa
Name: Daniel Costa <contact>
Classes: 2 packages by
Country: Brazil Brazil
Age: 32
All time rank: 1773121 in Brazil Brazil
Week rank: 1653 Up119 in Brazil Brazil Up

Details  
PHP class for the Dreamhost API [![Build Status](https://travis-ci.org/danielcosta/php-dreamhost.png?branch=master)](https://travis-ci.org/danielcosta/php-dreamhost)
===============================

Interfaces with the Dreamhost API

Installation
------------

Package available on [Composer](http://packagist.org/packages/danielcosta/php-dreamhost). Autoloading is [PSR-0](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md) 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](http://wiki.dreamhost.com/API/Api_commands) 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
    }
  Files folder image Files  
File Role Description
Files folder imagesrc (1 directory)
Files folder imagetests (2 files, 1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imageDanielCosta (1 directory)

  Files folder image Files  /  src  /  DanielCosta  
File Role Description
Files folder imageDreamhost (1 file)

  Files folder image Files  /  src  /  DanielCosta  /  Dreamhost  
File Role Description
  Plain text file Dreamhost.php Class Class source

  Files folder image Files  /  tests  
File Role Description
Files folder imagesrc (1 directory)
  Accessible without login Plain text file bootstrap.php Aux. Auxiliary script
  Accessible without login Plain text file phpunit.xml Data Auxiliary data

  Files folder image Files  /  tests  /  src  
File Role Description
Files folder imageDanielCosta (1 directory)

  Files folder image Files  /  tests  /  src  /  DanielCosta  
File Role Description
Files folder imageDreamhost (1 file)

  Files folder image Files  /  tests  /  src  /  DanielCosta  /  Dreamhost  
File Role Description
  Accessible without login Plain text file DreamhostTest.php Test Unit test script

 Version Control Unique User Downloads Download Rankings  
 100%Total:115All time:8,114
 This week:0This week:1,076Up