dev-master
9999999-devA laravel 5 package to easily create and maitain vps on digital ocean
MIT
The Requires
by Nehal Hasnayeen
laravel vps digital-ocean
A laravel 5 package to easily create and maitain vps on digital ocean
A laravel 5 package to easily create and maitain vps on digital ocean. Yet to complete Have a look at the usage ``` php $value = ["name"=> "test.com","region"=> "blr1","size"=> "512mb","image"=> "centos-7-2-x64"]; $result = VPS::droplet()->create($value);, (*2)
We just created a droplet in digital ocean. ``` php $result = VPS::droplet($id)->delete();
We just deleted a droplet by passing the id of our droplet., (*3)
Want to shutdown a droplet ``` php $result = VPS::droplet($id)->shutdown();, (*4)
How about getting all droplets we created ``` php $result = VPS::droplet()->all();
You can pull in the package via composer: ``` bash $ composer require iluminar/vps, (*5)
Or you can add this in your composer.json ``` bash "require": { "iluminar/vps": "dev-develop" }
and then terminal from your root directory of project run following command ``` bash $ composer update, (*6)
After updating composer, add a fluent service provider to the providers array in config/app.php file. ``` php 'providers' => array( // ... Iluminar\VPS\Providers\VPSServiceProvider::class, )
then run in terminal ``` bash $ php artisan vendor:publish, (*7)
## Configuration First you have to get a [personal access token](https://cloud.digitalocean.com/settings/api/tokens) and set the `DIGITAL_OCEAN_TOKEN` in the .env file. ## Usage Import the `VPS` facade in your controller ### Account information ``` php $result = VPS::account();
Get all actions performed on an account ``` php $result = VPS::action()->all();, (*8)
Get information of an action ``` php $result = VPS::action()->find($id);
Get information of all droplets ``` php $result = VPS::droplet()->all();, (*9)
Get information of a single droplet ``` php $result = VPS::droplet()->find($id);
Get all snapshots of a droplet ``` php $result = VPS::droplet($id)->snapshots();, (*10)
Get all backups of a droplet ``` php $result = VPS::droplet($id)->backups();
Enable backups of a droplet ``` php $result = VPS::droplet($id)->enableBackups();, (*11)
Disable backups of a droplet ``` php $result = VPS::droplet($id)->disableBackups();
Reboot a droplet ``` php $result = VPS::droplet($id)->reboot();, (*12)
Power cycle a droplet ``` php $result = VPS::droplet($id)->powerCycle();
Shutdown a droplet ``` php $result = VPS::droplet($id)->shutdown();, (*13)
Power off a droplet ``` php $result = VPS::droplet($id)->powerOff();
Power on a droplet ``` php $result = VPS::droplet($id)->powerOn();, (*14)
Restore a droplet by providing a id of previous image ``` php $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 ``` php $result = VPS::droplet($id)->resize('1gb'); $result = VPS::droplet($id)->resize('1gb', true); // permanent resize, (*15)
Rebuild a droplet, pass a image id or slug as a parameter ``` php $result = VPS::droplet($id)->rebuild($id); $result = VPS::droplet($id)->rebuild('ubuntu-14-04-x64'); // rebuild by image slug
Rename a droplet, pass a string as a parameter ``` php $result = VPS::droplet($id)->rebuild('name');, (*16)
Enable ipv6 on a droplet ``` php $result = VPS::droplet($id)->enableIPv6();
Enable private networking on a droplet ``` php $result = VPS::droplet($id)->enablePrivateNetworking();, (*17)
Take snapshot of a droplet, pass a string as a parameter to name the snapshot ``` php $result = VPS::droplet($id)->takeSnapshot('new nifty snapshot');
Get information of a action performed on this droplet ``` php $result = VPS::droplet($id)->action($actionId);, (*18)
### Get image information List all images ``` php $result = VPS::image()->all();
List all distribution images ``` php $result = VPS::image()->where(['type' => 'distribution']);, (*19)
List all application images ``` php $result = VPS::image()->where(['type' => 'application']);
List all private images of user ``` php $result = VPS::image()->where(['private' => 'true']);, (*20)
Get information of a single image ``` php $result = VPS::image()->find($id);
Get information of a single image by slug ``` php $result = VPS::image()->find('ubuntu-14-04-x64');, (*21)
List all actions for an images ``` php $result = VPS::image($id)->actions();
Rename an image ``` php $result = VPS::image($id)->rename('new cool name');, (*22)
Delete an image ``` php $result = VPS::image($id)->delete();
Transfer an image to a different region ``` php $result = VPS::image($id)->transfer('nyc1');, (*23)
Convert an image to a snapshot ``` php $result = VPS::image($id)->convert();
Get information of an action performed on an image ``` php $result = VPS::image($id)->action($actionId);, (*24)
### SSH keys List all keys associated with this account ``` php $result = VPS::ssh()->all();
Add a new ssh key to your account ``` php $result = VPS::ssh()->create(['name' => 'my-home-key', 'public_key' => "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAQQDDHr/jh2Jy"]);, (*25)
Get information about a key by key id or fingerprint ``` php $result = VPS::ssh()->find($id); // or $fingerprint instead of $id
Rename a key ``` php $result = VPS::ssh($id)->rename('new key name');, (*26)
Delete a key ``` php $result = VPS::ssh($id)->delete(); // $fingerprint can also be used instead of $id
Yet to be added., (*27)
documentation, (*28)
Error handling, (*29)
If you discover a security vulnerability in the package, please send an e-mail to Nehal Hasnayeen at searching.nehal@gmail.com. All security vulnerabilities will be promptly addressed., (*30)
The Iluminar\VPS is open-sourced software licensed under the MIT license., (*31)
Please see CHANGELOG for more information what has changed recently., (*32)
Made by Hasnayeen with love in , (*33)
A laravel 5 package to easily create and maitain vps on digital ocean
MIT
laravel vps digital-ocean