A laravel 5 package to easily create and maitain vps on digital ocean. Yet to complete Have a look at the usage
$value = ["name"=> "test.com","region"=> "blr1","size"=> "512mb","image"=> "centos-7-2-x64"];
$result = VPS::droplet()->create($value);We just created a droplet in digital ocean.
$result = VPS::droplet($id)->delete();We just deleted a droplet by passing the id of our droplet.
Want to shutdown a droplet
$result = VPS::droplet($id)->shutdown();How about getting all droplets we created
$result = VPS::droplet()->all();You can pull in the package via composer:
$ composer require iluminar/vpsOr you can add this in your composer.json
"require": {
"iluminar/vps": "dev-develop"
}and then terminal from your root directory of project run following command
$ composer updateAfter updating composer, add a fluent service provider to the providers array in config/app.php file.
'providers' => array(
// ...
Iluminar\VPS\Providers\VPSServiceProvider::class,
)then run in terminal
$ php artisan vendor:publishFirst you have to get a personal access token and set the DIGITAL_OCEAN_TOKEN in the .env file.
Import the VPS facade in your controller
$result = VPS::account();Get all actions performed on an account
$result = VPS::action()->all();Get information of an action
$result = VPS::action()->find($id);Get information of all droplets
$result = VPS::droplet()->all();Get information of a single droplet
$result = VPS::droplet()->find($id);Get all snapshots of a droplet
$result = VPS::droplet($id)->snapshots();Get all backups of a droplet
$result = VPS::droplet($id)->backups();Enable backups of a droplet
$result = VPS::droplet($id)->enableBackups();Disable backups of a droplet
$result = VPS::droplet($id)->disableBackups();Reboot a droplet
$result = VPS::droplet($id)->reboot();Power cycle a droplet
$result = VPS::droplet($id)->powerCycle();Shutdown a droplet
$result = VPS::droplet($id)->shutdown();Power off a droplet
$result = VPS::droplet($id)->powerOff();Power on a droplet
$result = VPS::droplet($id)->powerOn();Restore a droplet by providing a id of previous image
$result = VPS::droplet($id)->restore();Resize a droplet, pass a size parameter (1gb, 2gb etc..). For permanent resize also passed a boolen valu of true
$result = VPS::droplet($id)->resize('1gb');
$result = VPS::droplet($id)->resize('1gb', true); // permanent resizeRebuild a droplet, pass a image id or slug as a parameter
$result = VPS::droplet($id)->rebuild($id);
$result = VPS::droplet($id)->rebuild('ubuntu-14-04-x64'); // rebuild by image slugRename a droplet, pass a string as a parameter
$result = VPS::droplet($id)->rebuild('name');Enable ipv6 on a droplet
$result = VPS::droplet($id)->enableIPv6();Enable private networking on a droplet
$result = VPS::droplet($id)->enablePrivateNetworking();Take snapshot of a droplet, pass a string as a parameter to name the snapshot
$result = VPS::droplet($id)->takeSnapshot('new nifty snapshot');Get information of a action performed on this droplet
$result = VPS::droplet($id)->action($actionId);List all images
$result = VPS::image()->all();List all distribution images
$result = VPS::image()->where(['type' => 'distribution']);List all application images
$result = VPS::image()->where(['type' => 'application']);List all private images of user
$result = VPS::image()->where(['private' => 'true']);Get information of a single image
$result = VPS::image()->find($id);Get information of a single image by slug
$result = VPS::image()->find('ubuntu-14-04-x64');List all actions for an images
$result = VPS::image($id)->actions();Rename an image
$result = VPS::image($id)->rename('new cool name');Delete an image
$result = VPS::image($id)->delete();Transfer an image to a different region
$result = VPS::image($id)->transfer('nyc1');Convert an image to a snapshot
$result = VPS::image($id)->convert();Get information of an action performed on an image
$result = VPS::image($id)->action($actionId);List all keys associated with this account
$result = VPS::ssh()->all();Add a new ssh key to your account
$result = VPS::ssh()->create(['name' => 'my-home-key', 'public_key' => "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAQQDDHr/jh2Jy"]);Get information about a key by key id or fingerprint
$result = VPS::ssh()->find($id); // or $fingerprint instead of $idRename a key
$result = VPS::ssh($id)->rename('new key name');Delete a key
$result = VPS::ssh($id)->delete(); // $fingerprint can also be used instead of $idYet to be added.
documentation
Error handling
If you discover a security vulnerability in the package, please send an e-mail to Nehal Hasnayeen at [email protected]. All security vulnerabilities will be promptly addressed.
The Iluminar\VPS is open-sourced software licensed under the MIT license.
Please see CHANGELOG for more information what has changed recently.
Made by Hasnayeen with love in