PHP code example of lionix / digitalocean

1. Go to this page and download the library: Download lionix/digitalocean 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/ */

    

lionix / digitalocean example snippets




namespace App\Http\Controllers;

use Digitalocean\Services\DropletsService;

class DigitalOceanController extends Controller
{
    /**
     * @throws \GuzzleHttp\Exception\GuzzleException
     * @throws \JsonException
     */
    public function droplets(DropletsService $dropletsService): \Illuminate\Http\JsonResponse
    {
        $droplets = $dropletsService->list();

        return response()->json($droplets);
    }
}

Droplets::list();

Digitalocean::droplets()->list();
bash
php artisan vendor:publish --provider="Lionix\DigitalOcean\DigitalOceanServiceProvider" --tag="config"