2017 © Pedro Peláez
 

library digitalocean-php

An easy to use wrapper for the DigitalOcean API written in PHP.

image

pxgamer/digitalocean-php

An easy to use wrapper for the DigitalOcean API written in PHP.

  • Thursday, February 8, 2018
  • by PXgamer
  • Repository
  • 1 Watchers
  • 1 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 15 Versions
  • 0 % Grown

The README.md

digitalocean-php

Latest Version on Packagist ![Software License][ico-license] Build Status Style CI ![Code Coverage][ico-code-quality] Total Downloads, (*1)

An easy to use wrapper for the DigitalOcean API written in PHP., (*2)

Structure

src/
tests/
vendor/

Install

Via Composer, (*3)

``` bash $ composer require pxgamer/digitalocean-php, (*4)


## Usage ```php use \pxgamer\DigitalOcean\Client; $client = new Client();

Classes

Client - This is the main class and is used to hold the CURL functions. It also contains the API key, and should be called first.
- This class must be passed to other classes upon their initialisation., (*5)

Account - This class is used to retrieve account information., (*6)

Domains - This class is used to modify and retrieve domain information., (*7)

Droplets - This class is used to manage multiple droplets, or all droplets for an account., (*8)

Droplet - This class is used to manage droplets individually and can provides functions such as creating snapshots, enabling and disabling features, etc., (*9)

// Use the specific classes as their short names
use \pxgamer\DigitalOcean;

// Create a new Client instance
$client   = new DigitalOcean\Client();
$client->setAuthKey('API_KEY');

// Initialise a new instance of each class
$account  = new DigitalOcean\Account($client);
$domains  = new DigitalOcean\Domains($client);
$droplets = new DigitalOcean\Droplets($client);
$droplet  = new DigitalOcean\Droplet($client);

Methods

Client Class

/**
 * This is required to be initialised first.
 * It must be passed into all other classes.
 */
use \pxgamer\DigitalOcean\Client;
$client = new Client();
$client->setAuthKey('API_KEY');

Account Class

Initialise Account Class, (*10)

use \pxgamer\DigitalOcean\Account;
$account = new Account($client);

Getting Account Information, (*11)

$account->getAccount();

Domains Class

Initialise Domains Class, (*12)

use \pxgamer\DigitalOcean\Domains;
$domains = new Domains($client);

Getting a list of domains, (*13)

$domains->listDomains();

Getting information for a specific domain, (*14)

$domains->getDomain('example.com');

Create a new domain, (*15)

$domains->createDomain('example.com');

Deleting a domain, (*16)

$domains->deleteDomain('example.com');

Droplets Class

Initialise Droplets Class, (*17)

// Requires the Client class to be initialised
use \pxgamer\DigitalOcean\Droplets;
$droplets = new Droplets($client);

Listing droplets, (*18)

$droplets->listDroplets();

Listing neighbours of Droplets (droplets in the same location), (*19)

$droplets->listNeighbours();

Droplet Class

Initialise Droplet Class, (*20)

// Requires the Client class to be initialised
use \pxgamer\DigitalOcean\Droplet;
$droplet = new Droplet($client);

Setting the Droplet ID, (*21)

$droplet->setDroplet('DROPLET_ID');

Getting information about a droplet, (*22)

// Requires the droplet ID to be set
$droplet->getDroplet();

Creating a Droplet, (*23)

$dropletAttributes = (array)[
    'name' => 'example.com',       // Required
    'region' => 'nyc3',            // Required
    'size' => '512mb',             // Required
    'image' => 'ubuntu-14-04-x64', // Required
    'ssh_keys' => null,
    'backups' => false,
    'ipv6' => true,
    'user_data' => null,
    'private_networking' => null,
    'volume' => null,
    'tags' => [
        'web'
    ],
];

$droplet->createDroplet($dropletAttributes);

Deleting a Droplet, (*24)

// Requires the droplet ID to be set
$droplet->deleteDroplet();

Listing a Droplet's neighbours, (*25)

// Requires the droplet ID to be set
$droplet->listNeighbours();

Create a snapshot, (*26)

// Requires the droplet ID to be set
$droplet->createSnapshot('SNAPSHOT-NAME');

Enabling backups for a Droplet, (*27)

// Requires the droplet ID to be set
$droplet->enableBackups();

Disabling backups for a Droplet, (*28)

// Requires the droplet ID to be set
$droplet->disableBackups();

Rebooting a Droplet, (*29)

// Requires the droplet ID to be set
$droplet->reboot();

Power Cycling a Droplet, (*30)

// Requires the droplet ID to be set
$droplet->powerCycle();

Shutting down a Droplet, (*31)

// Requires the droplet ID to be set
$droplet->shutdown();

Powering off a Droplet, (*32)

// Requires the droplet ID to be set
$droplet->powerOff();

Powering on a Droplet, (*33)

// Requires the droplet ID to be set
$droplet->powerOn();

Resizing a Droplet, (*34)

/**
 * Requires the droplet ID to be set
 *
 * Attributes:
 * - $size [string] (e.g. '1gb')
 * - $increaseDiskSize [boolean] (e.g. false) - Determines whether this is a permanent resize or not
 */

$droplet->resize('1gb', false);

Reset a Droplet's password, (*35)

// Requires the droplet ID to be set
$droplet->passwordReset();

Renaming a Droplet, (*36)

// Requires the droplet ID to be set
$droplet->rename('NEW_DROPLET_NAME');

Enable IPv6 for a Droplet, (*37)

// Requires the droplet ID to be set
$droplet->enableIPv6();

Enable Private Networking for a Droplet, (*38)

// Requires the droplet ID to be set
$droplet->enablePrivateNetworking();

Change log

Please see CHANGELOG for more information on what has changed recently., (*39)

Testing

bash $ composer test, (*40)

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details., (*41)

Security

If you discover any security related issues, please email owzie123@gmail.com instead of using the issue tracker., (*42)

Credits

License

The MIT License (MIT). Please see License File for more information., (*43)

The Versions

08/02 2018

dev-develop

dev-develop

An easy to use wrapper for the DigitalOcean API written in PHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

06/12 2017

dev-master

9999999-dev

An easy to use wrapper for the DigitalOcean API written in PHP.

  Sources   Download

MIT

The Requires

  • ext-curl *
  • php ^7.1

 

The Development Requires

by Avatar PXgamer

06/12 2017

v2.1.2

2.1.2.0

An easy to use wrapper for the DigitalOcean API written in PHP.

  Sources   Download

MIT

The Requires

  • php ^7.1
  • ext-curl *

 

The Development Requires

20/11 2017

v2.1.1

2.1.1.0

An easy to use wrapper for the DigitalOcean API written in PHP.

  Sources   Download

MIT

The Requires

  • php ^7.1
  • ext-curl *

 

The Development Requires

09/11 2017

v2.1.0

2.1.0.0

An easy to use wrapper for the DigitalOcean API written in PHP.

  Sources   Download

MIT

The Requires

  • php ^7.1
  • ext-curl *

 

The Development Requires

02/11 2017

v2.0.2

2.0.2.0 https://github.com/PXgamer/digitalocean-php

An easy to use wrapper for the DigitalOcean API written in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.6.0
  • ext-curl *

 

The Development Requires

02/11 2017

v2.0.1

2.0.1.0 https://github.com/PXgamer/digitalocean-php

An easy to use wrapper for the DigitalOcean API written in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.6.0
  • ext-curl *

 

The Development Requires

01/10 2017

v1.0

1.0.0.0

  Sources   Download

01/10 2017

v1.0.1

1.0.1.0

  Sources   Download

03/01 2017

v2.0.0

2.0.0.0 https://github.com/PXgamer/digitalocean-php

An easy to use wrapper for the DigitalOcean API written in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

by Avatar PXgamer

24/12 2016

v1.0.6

1.0.6.0 https://github.com/PXgamer/digitalocean-php

An easy to use wrapper for the DigitalOcean API written in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

by Avatar PXgamer

24/12 2016

v1.0.5

1.0.5.0 https://github.com/PXgamer/digitalocean-php

An easy to use wrapper for the DigitalOcean API written in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

by Avatar PXgamer

12/12 2016

v1.0.4

1.0.4.0 https://github.com/PXgamer/digitalocean-php

An easy to use wrapper for the DigitalOcean API written in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

by Avatar PXgamer

07/12 2016

v1.0.3

1.0.3.0 https://github.com/PXgamer/digitalocean-php

An easy to use wrapper for the DigitalOcean API written in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

by Avatar PXgamer

07/12 2016

v1.0.2

1.0.2.0 https://github.com/PXgamer/digitalocean-php

An easy to use wrapper for the DigitalOcean API written in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

by Avatar PXgamer