Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/marcelod/codeigniter-digitalocean

A CodeIgniter library for using the DigitalOcean API
https://github.com/marcelod/codeigniter-digitalocean

Last synced: 3 months ago
JSON representation

A CodeIgniter library for using the DigitalOcean API

Awesome Lists containing this project

README

        

CodeIgniter DigitalOcean Library
========================

A CodeIgniter library for using the DigitalOcean API. All methods supported.

A port of the [DigitalOcean PHP Class](https://github.com/tuefekci/DigitalOcean-PHP-Class) by [Giacomo Tüfekci](https://github.com/tuefekci).

Documentation for the [Digital Ocean API](https://www.digitalocean.com/api) can be found here.

Installation
---------------------
To install simply copy the contents of the **config**, **helper** and **library** folders into the same folders in your CodeIgniter project application folder.

Config
---------------------
To configure this library you must enter your DigitalOcean **Client ID** and **API Key** into `config/digitalocean.php`.

Instructions on how to generate this information can be found on the [DigitalOcean website](https://www.digitalocean.com/community/articles/how-to-use-the-digitalocean-api).

Example Usage
---------------------
```PHP
load->library('digitalocean');

$query = $this->digitalocean->getDroplets();

print 'Status: ' . $query->status . '

';

foreach ($query->droplets as $droplet){
print 'Name: ' . $droplet->name . '
';
print 'IP: ' . $droplet->ip_address . '
';
print '
';
}
}
}

/* End of file example.php */
/* Location: ./application/controllers/example.php */
```
The above will result in something like this:
```
Status: OK

Name: your-droplet-name
IP: your-droplet-ip

Name: your-droplet-name
IP: your-droplet-ip

etc.
```