{"id":21486180,"url":"https://github.com/pxgamer/digitalocean-php","last_synced_at":"2025-03-17T10:11:12.448Z","repository":{"id":57046091,"uuid":"71349574","full_name":"pxgamer/digitalocean-php","owner":"pxgamer","description":"An easy to use wrapper for the DigitalOcean API written in PHP.","archived":false,"fork":false,"pushed_at":"2018-02-08T10:32:20.000Z","size":87,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-23T19:38:41.784Z","etag":null,"topics":["php-wrapper"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/pxgamer/digitalocean-php","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pxgamer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-19T11:19:04.000Z","updated_at":"2022-03-08T12:46:10.000Z","dependencies_parsed_at":"2022-08-24T03:40:12.822Z","dependency_job_id":null,"html_url":"https://github.com/pxgamer/digitalocean-php","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pxgamer%2Fdigitalocean-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pxgamer%2Fdigitalocean-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pxgamer%2Fdigitalocean-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pxgamer%2Fdigitalocean-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pxgamer","download_url":"https://codeload.github.com/pxgamer/digitalocean-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244014134,"owners_count":20383715,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php-wrapper"],"created_at":"2024-11-23T13:19:36.604Z","updated_at":"2025-03-17T10:11:12.403Z","avatar_url":"https://github.com/pxgamer.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# digitalocean-php\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Software License][ico-license]](LICENSE.md)\n[![Build Status][ico-travis]][link-travis]\n[![Style CI][ico-styleci]][link-styleci]\n[![Code Coverage][ico-code-quality]][link-code-quality]\n[![Total Downloads][ico-downloads]][link-downloads]\n\nAn easy to use wrapper for the DigitalOcean API written in PHP.\n\n## Structure\n\n```\nsrc/\ntests/\nvendor/\n```\n\n## Install\n\nVia Composer\n\n``` bash\n$ composer require pxgamer/digitalocean-php\n```\n\n## Usage\n\n```php\nuse \\pxgamer\\DigitalOcean\\Client;\n$client = new Client();\n```\n\n### Classes\n\n_Client_\n- This is the main class and is used to hold the CURL functions. It also contains the API key, and should be called first.  \n- _This class **must** be passed to other classes upon their initialisation._  \n\n_Account_\n- This class is used to retrieve account information.  \n\n_Domains_\n- This class is used to modify and retrieve domain information.  \n\n_Droplets_\n- This class is used to manage multiple droplets, or all droplets for an account.  \n\n_Droplet_\n- This class is used to manage droplets individually and can provides functions such as creating snapshots, enabling and disabling features, etc.  \n\n```php\n// Use the specific classes as their short names\nuse \\pxgamer\\DigitalOcean;\n\n// Create a new Client instance\n$client   = new DigitalOcean\\Client();\n$client-\u003esetAuthKey('API_KEY');\n\n// Initialise a new instance of each class\n$account  = new DigitalOcean\\Account($client);\n$domains  = new DigitalOcean\\Domains($client);\n$droplets = new DigitalOcean\\Droplets($client);\n$droplet  = new DigitalOcean\\Droplet($client);\n```\n\n### Methods\n\n#### Client Class\n\n```php\n/**\n * This is required to be initialised first.\n * It must be passed into all other classes.\n */\nuse \\pxgamer\\DigitalOcean\\Client;\n$client = new Client();\n$client-\u003esetAuthKey('API_KEY');\n```\n\n#### Account Class\n\n_Initialise Account Class_\n\n```php\nuse \\pxgamer\\DigitalOcean\\Account;\n$account = new Account($client);\n```\n\n_Getting Account Information_\n\n```php\n$account-\u003egetAccount();\n```\n\n#### Domains Class\n\n_Initialise Domains Class_\n\n```php\nuse \\pxgamer\\DigitalOcean\\Domains;\n$domains = new Domains($client);\n```\n\n_Getting a list of domains_\n\n```php\n$domains-\u003elistDomains();\n```\n\n_Getting information for a specific domain_\n\n```php\n$domains-\u003egetDomain('example.com');\n```\n\n_Create a new domain_\n\n```php\n$domains-\u003ecreateDomain('example.com');\n```\n\n_Deleting a domain_\n\n```php\n$domains-\u003edeleteDomain('example.com');\n```\n\n#### Droplets Class\n\n_Initialise Droplets Class_\n\n```php\n// Requires the Client class to be initialised\nuse \\pxgamer\\DigitalOcean\\Droplets;\n$droplets = new Droplets($client);\n```\n\n_Listing droplets_\n\n```php\n$droplets-\u003elistDroplets();\n```\n\n_Listing neighbours of Droplets (droplets in the same location)_\n\n```php\n$droplets-\u003elistNeighbours();\n```\n\n#### Droplet Class\n\n_Initialise Droplet Class_\n\n```php\n// Requires the Client class to be initialised\nuse \\pxgamer\\DigitalOcean\\Droplet;\n$droplet = new Droplet($client);\n```\n\n_Setting the Droplet ID_\n\n```php\n$droplet-\u003esetDroplet('DROPLET_ID');\n```\n\n_Getting information about a droplet_\n\n```php\n// Requires the droplet ID to be set\n$droplet-\u003egetDroplet();\n```\n\n_Creating a Droplet_\n\n```php\n$dropletAttributes = (array)[\n    'name' =\u003e 'example.com',       // Required\n    'region' =\u003e 'nyc3',            // Required\n    'size' =\u003e '512mb',             // Required\n    'image' =\u003e 'ubuntu-14-04-x64', // Required\n    'ssh_keys' =\u003e null,\n    'backups' =\u003e false,\n    'ipv6' =\u003e true,\n    'user_data' =\u003e null,\n    'private_networking' =\u003e null,\n    'volume' =\u003e null,\n    'tags' =\u003e [\n        'web'\n    ],\n];\n\n$droplet-\u003ecreateDroplet($dropletAttributes);\n```\n\n_Deleting a Droplet_\n\n```php\n// Requires the droplet ID to be set\n$droplet-\u003edeleteDroplet();\n```\n\n_Listing a Droplet's neighbours_\n\n```php\n// Requires the droplet ID to be set\n$droplet-\u003elistNeighbours();\n```\n\n_Create a snapshot_\n\n```php\n// Requires the droplet ID to be set\n$droplet-\u003ecreateSnapshot('SNAPSHOT-NAME');\n```\n\n_Enabling backups for a Droplet_\n\n```php\n// Requires the droplet ID to be set\n$droplet-\u003eenableBackups();\n```\n\n_Disabling backups for a Droplet_\n\n```php\n// Requires the droplet ID to be set\n$droplet-\u003edisableBackups();\n```\n\n_Rebooting a Droplet_\n\n```php\n// Requires the droplet ID to be set\n$droplet-\u003ereboot();\n```\n\n_Power Cycling a Droplet_\n\n```php\n// Requires the droplet ID to be set\n$droplet-\u003epowerCycle();\n```\n\n_Shutting down a Droplet_\n\n```php\n// Requires the droplet ID to be set\n$droplet-\u003eshutdown();\n```\n\n_Powering off a Droplet_\n\n```php\n// Requires the droplet ID to be set\n$droplet-\u003epowerOff();\n```\n\n_Powering on a Droplet_\n\n```php\n// Requires the droplet ID to be set\n$droplet-\u003epowerOn();\n```\n\n_Resizing a Droplet_\n\n```php\n/**\n * Requires the droplet ID to be set\n *\n * Attributes:\n * - $size [string] (e.g. '1gb')\n * - $increaseDiskSize [boolean] (e.g. false) - Determines whether this is a permanent resize or not\n */\n\n$droplet-\u003eresize('1gb', false);\n```\n\n_Reset a Droplet's password_\n\n```php\n// Requires the droplet ID to be set\n$droplet-\u003epasswordReset();\n```\n\n_Renaming a Droplet_\n\n```php\n// Requires the droplet ID to be set\n$droplet-\u003erename('NEW_DROPLET_NAME');\n```\n\n_Enable IPv6 for a Droplet_\n\n```php\n// Requires the droplet ID to be set\n$droplet-\u003eenableIPv6();\n```\n\n_Enable Private Networking for a Droplet_\n\n```php\n// Requires the droplet ID to be set\n$droplet-\u003eenablePrivateNetworking();\n```\n\n## Change log\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Testing\n\n``` bash\n$ composer test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) and [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) for details.\n\n## Security\n\nIf you discover any security related issues, please email owzie123@gmail.com instead of using the issue tracker.\n\n## Credits\n\n- [pxgamer][link-author]\n- [All Contributors][link-contributors]\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[ico-version]: https://img.shields.io/packagist/v/pxgamer/digitalocean-php.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-travis]: https://img.shields.io/travis/pxgamer/digitalocean-php/master.svg?style=flat-square\n[ico-styleci]: https://styleci.io/repos/71349574/shield\n[ico-code-quality]: https://img.shields.io/codecov/c/github/pxgamer/digitalocean-php.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/pxgamer/digitalocean-php.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/pxgamer/digitalocean-php\n[link-travis]: https://travis-ci.org/pxgamer/digitalocean-php\n[link-styleci]: https://styleci.io/repos/71349574\n[link-code-quality]: https://codecov.io/gh/pxgamer/digitalocean-php\n[link-downloads]: https://packagist.org/packages/pxgamer/digitalocean-php\n[link-author]: https://github.com/pxgamer\n[link-contributors]: ../../contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpxgamer%2Fdigitalocean-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpxgamer%2Fdigitalocean-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpxgamer%2Fdigitalocean-php/lists"}