nicknick-io/digitalocean-v2

Fluent API for the Digital Ocean V2

0.0.1 2020-01-16 22:48 UTC

This package is auto-updated.

Last update: 2024-04-19 21:10:27 UTC


README

HEADER This is a wrapper for the Digitalocean API (Issues / Changelog)

Installation

<?php
require 'vendor/autoload.php';
use NickNickIO\Digitalocean\Digitalocean;

$digitalocean = new Digitalocean('your_access_token');

Resources

Account
// Return an account object
$account = $digitalocean->account->get();

Balance (NEW)

// Return the customer balance
$balance = $digitalocean->balance->customer();
Action
// Return a collection of Action objects
$actions = $digitalocean->action->all();

// Return an Action object.
$action = $digitalocean->action->get(123);
Domain
// Return a collection of Domain objects
$domains = $digitalocean->domain->all();

// Return a Domain object
$domain = $digitalocean->domain->get('foo.dk');

// Return the created domain called bar.dk
$domain = $digitalocean->domain->create('bar.dk');

// Delete the domain called baz.dk
$digitalocean->domain->delete('baz.dk');
Domain Record
// Return a collection DomainRecord objects
$records = $digitalocean->domainRecord->all();

// Return a DomainRecord object
$record = $digitalocean->domainRecord->get('baz.dk', 123);
Droplet
// Return a collection of Droplet objects
$droplets = $digitalocean->droplet->all();

// Return a Droplet object
$droplet = $digitalocean->droplet->get(123);

// Return the created droplet
$droplet = $digitalocean->droplet->create([
    'name' => 'test-droplet',
    'image' => 31650475,
    'region' => 'fra1',
    'size' => 's-1vcpu-1gb'
]);

// Delete a droplet
$digitalocean->droplet->delete(123);
Firewall
// List all firewalls
$firewalls = $digitalocean->firewall->all();