The Laravel DigitalOcean package by Graham Campbell is an API client bridge for Laravel. This package uses Graham's manager package, providing the ability to configure multiple connections.
use GrahamCampbell\DigitalOcean\Facades\DigitalOcean; DigitalOcean::droplet()->powerOn(12345); DigitalOcean::size()->getAll(); // Specify a connection nameDigitalOcean::connection('your_connection_name') ->droplet() ->getById(12345);
The package integrates with Laravel's service container, allowing you to use the package's Facade or use dependency injection to use the manager:
use GrahamCampbell\DigitalOcean\DigitalOceanManager; public function __construct(private DigitalOceanManager $digitalocean){ // ... $this->digitalocean->region()->getAll();}
As mentioned in the README, this package is a bridge for the DigitalOcean PHP API client. You can see more examples of how you can use this client to interact with DigitalOcean.
For reference, the published digitalocean.php
configuration file includes a setting to define the default connection name, as well as the ability to configure as many connections as you need:
return [ 'default' => 'main', 'connections' => [ 'main' => [ 'token' => 'your-token', 'method' => 'token', ], ],];
This package supports a wide variety of Laravel versions, the latest supporting Laravel v8 to v11. For more details, visit the GitHub repository and explore its extensive documentation and examples.