In a new tutorial on the NetTuts.com site they show you how to use a Digital Ocean PHP SDK to manage your cloud instances from a PHP-based application.
The Digital Ocean API allows you to manage Droplets and resources in a simple, programmatic way using HTTP requests. All of the functionality that you are familiar with in the Digital Ocean control panel is also available through the API, allowing you to script the complex actions that your situation requires. For this tutorial, we'll integrate developer Antoine Corcy's Digital Ocean V2 PHP API Library into a Yii-based console application.
They walk you through the full process of the setup - getting your access keys, getting the PHP SDK and setting up a component as an interface for the rest of the Yii2 application to use. From there, he shows three examples of the types of commands to can issue:
- Fetching Droplets
- Fetching Images
- Automating Snapshots
Each example comes with the code to implement it and screenshots of both how the same functionality looks in the Digital Ocean control panel and the output of their script.