PHP code example of toin0u / digitalocean-laravel

1. Go to this page and download the library: Download toin0u/digitalocean-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

toin0u / digitalocean-laravel example snippets


'providers' => array(
    // ...

    'Toin0u\DigitalOcean\DigitalOceanServiceProvider',
)

'aliases' => array(
    // ...

    'DigitalOcean' => 'Toin0u\DigitalOcean\DigitalOceanFacade',
)

// if you don't want to use the defaut adapter but rather Buzz
DigitalOcean::setAdapter(new \HttpAdapter\BuzzHttpAdapter());
$activeDroplets = DigitalOcean::droplets()->showAllActive();
var_dump($activeDroplets);

// object(stdClass)[61]
// public 'status' => string 'OK' (length=2)
// public 'droplets' =>
//     array (size=1)
//         0 =>
//             object(stdClass)[62]
//                 public 'id' => int 347553
//                 public 'name' => string 'foobar' (length=6)
//                 public 'image_id' => int 284212
//                 public 'size_id' => int 66
//                 public 'region_id' => int 4
//                 public 'backups_active' => boolean false
//                 public 'ip_address' => string '192.241.175.217' (length=15)
//                 public 'private_ip_address' => null
//                 public 'locked' => boolean false
//                 public 'status' => string 'active' (length=6)
//                 public 'created_at' => string '2013-01-07T01:37:21Z' (length=20)
bash
$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar install
bash
$ php artisan config:publish toin0u/digitalocean-laravel