Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Digitalocean Laravel Package

toin0u/digitalocean

A PHP wrapper for the DigitalOcean API v2 that lets you manage droplets, images, SSH keys, sizes, regions, and domains through a clean, expressive interface. Simple to install and configure, it offers fluent methods for common cloud operations and is ideal for automating DigitalOcean resources from...

View on GitHub
Deep Wiki
Context7

Getting Started

  1. Install the package with Composer. On Laravel 5.5+ the service provider and facade are auto-discovered; on older versions register them manually in config/app.php.
  2. Publish the package config and set your DigitalOcean API token in .env:
    php artisan vendor:publish --provider="...\DigitalOceanServiceProvider"
    
    DIGITALOCEAN_TOKEN=your-token
    
  3. Look first at the package config file, the facade/service provider, and the README’s CLI section. The release adds richer Artisan output and new droplet fields, so the CLI is the quickest way to verify connectivity.
  4. First use case: list droplets and inspect their networking and backup state.
    php artisan droplet:list
    php artisan droplet:show {id}
    
    Then use the same client programmatically to fetch a droplet and read private_ip_address, backup counts, and snapshot counts.

Implementation Patterns

  • Inject the package client into services, jobs, and actions rather than calling the facade directly. This keeps DigitalOcean interactions testable and makes it easy to swap in a fake HTTP client in tests.
  • Use the client for machine-readable workflows and the Artisan commands for human inspection. The updated droplet:show command is useful for quickly checking backup and snapshot counts during incident response.
  • When provisioning internal services, read private_ip_address from the droplet payload and prefer it for service-to-service communication. Fall back to the public IP only when private networking is unavailable.
  • For region moves, use the renamed TransferCommand in scheduled tasks or deployment scripts. Keep transfer logic in a queued job or console command rather than a controller so long-running API calls do not block requests.
  • Use the new table-based CLI output for operator-facing tooling, but do not build automation on top of the rendered tables. For scripts, call the API/client directly or add a JSON output path if the package supports it.
  • Wrap API calls in try/catch blocks and retry on rate-limit or transient server errors. Log the droplet ID and action being attempted so failures are easy to trace.
  • In tests, bind a mocked client or use Laravel’s HTTP fake if the package uses the HTTP client under the hood. Assert on the request payloads for create, transfer, and snapshot operations.

Gotchas and Tips

  • Breaking change: TransfertCommand was renamed to TransferCommand. Search your codebase, scheduled tasks, shell scripts, aliases, and documentation for the old name. Update any direct class references and php artisan invocations.
  • Removed backup controls: enabling and disabling droplet backups was removed because the upstream API no longer supports it. If your code called those methods, remove the calls or manage backups through the DigitalOcean control panel/API directly. Audit upgrade PRs for silent no-ops.
  • Nullable private IP: private_ip_address may be null when private networking is not enabled. Guard against null before using it in connection strings or service discovery.
  • CLI output changed: commands now render with TableHelper. Any script that parsed the previous plain-text output may break. Prefer API calls over parsing CLI tables, and check whether commands expose a machine-readable format.
  • Config caching: after changing the token or config, run php artisan config:clear (and config:cache in production). Stale config is a common cause of authentication failures.
  • Token scope and rate limits: use a token with only the required scopes, and implement pagination for droplet lists. Handle 429 responses with backoff.
  • Extension points: publish and override the config, bind a custom client implementation in a service provider, and extend or wrap the Artisan commands if you need different output formats. Check the changelog for further breaking changes before upgrading minor versions.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route