PHPackages                             mfrost503/billow - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. mfrost503/billow

ActiveLibrary[API Development](/categories/api)

mfrost503/billow
================

Digital Ocean API Wrapper

2.0.0(7y ago)025MITPHP

Since Dec 1Pushed 7y agoCompare

[ Source](https://github.com/mfrost503/Billow)[ Packagist](https://packagist.org/packages/mfrost503/billow)[ Docs](https://github.com/mfrost503/Billow)[ RSS](/packages/mfrost503-billow/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (7)Used By (0)

Billow
======

[](#billow)

[![Build Status](https://camo.githubusercontent.com/3b499d71c0499719a6a4adebcc2e8defe033b82b3dd8727318b86ba272fcdad6/68747470733a2f2f7472617669732d63692e6f72672f6d66726f73743530332f42696c6c6f772e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mfrost503/Billow)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/31cef2cae4b6c75850f3a4292e1204f3d9ada9ac8ab38e87d56b59e4a91f9e17/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d66726f73743530332f42696c6c6f772f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mfrost503/Billow/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/8ff94a849d9d81555ebacfffb8e95ecd7f77fb5372860c723734e70a08803d8e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d66726f73743530332f42696c6c6f772f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mfrost503/Billow/?branch=master)

Billow is a Digital Ocean API wrapper that allows you to retrieve information, provision droplets (Virtual Machines) and perform actions on existing virtual machines. There are a couple different ways to interact with this library; convenience classes and direct client usage.

This README will serve as documentation for the library and provide examples of how to use the library with the convenience classes and directly with the client.

### Client

[](#client)

`Billow\Client` acts as an intermediary between Billow and an HTTP Client. By default, `Billow\Client` uses Guzzle 5.3 but it does make use of `Billow\ClientInterface` which allows you to create your own Client implementations. If you wanted to use Guzzle 6, it would be very easy to write a client that implements `Billow\ClientInterface` and write the implementations for the `get` and `post` methods to suit your needs.

### DropletService

[](#dropletservice)

The `DropletService` provides an easy way to retrieve, create, and perform actions on Droplets. If there are specific configurations for Guzzle that you normally use, you can pass them to the `Billow\Client` constructor, `Billow\Client` does not override the constructor; so the configurations can be passed the same way you'd pass them to `GuzzleHttp\Client`. If a client is not set, the DropletService will instantiate an instance of the default client. The only time you'll need to inject an instance of `Billow\Client` is if you have a default configuration.

#### Create

[](#create)

The create method requires that you provide a request body, along with your access token as an Authorization header. Digital Ocean provides some documentation for what the request body should look like: [Digital Ocean API v2 Create Droplet](https://developers.digitalocean.com/documentation/v2/#create-a-new-droplet). The body must be sent as an array, below is an example of the array that would be passed to the create method.

```
$dropletBody = [
    'name' => 'My New Droplet',
    'region' => 'nyc2',
    'size' => '40gb',
    'image' => 'ubuntu-14-04-x64',
    'ssh_keys' => ['public key content'],
    'backups' => true,
    'ipv6' => true,
    'private_networking' => true,
    'user_data' => 'meta data to be associated with the droplet'
];
```

So if we use the example from above, the call to create a new box would look like the following:

```
