planethoster / planethoster-api
PHP library for PlanetHoster API
1.4.2
2023-05-23 18:07 UTC
Requires
- php: ^7.3 || ^8.0
- guzzlehttp/guzzle: ~7.7.0
Requires (Dev)
- phpspec/phpspec: 7.4.0
This package is auto-updated.
Last update: 2025-05-04 14:39:03 UTC
README
PHP library for PlanetHoster API
Installation
We recommend to install this library with composer.
To install composer follow the official documentation. The following command should also work:
curl -sS https://getcomposer.org/installer | php
To install the library, enter the following command in your PHP project directory:
composer require planethoster/planethoster-api
Or edit composer.json
and add:
{ "require": { "planethoster/planethoster-api": "^1.0" } }
Adapter
Inspired by toin0u/DigitalOceanV2 design, we use Adapter
interface to make the Http requests.
By default, we provide an adapter for Guzzle with GuzzleHttpAdapter
.
You can also build your own by implementing the Adapter
interface.
Example
<?php require __DIR__ . '/vendor/autoload.php'; use PlanetHoster\Adapter\GuzzleHttpAdapter; use PlanetHoster\PlanetHoster; // create an adapter with api_user and api_key $adapter = new GuzzleHttpAdapter('your_api_user', 'your_api_key'); // create a PlanetHoster object $planethoster = new PlanetHoster($adapter); // Get your PlanetHoster account information $infos = $planethoster->account()->Info(); // ...
Credits
- Gabriel Poulenard-Talbot for PlanetHoster
Support
Please open an issue in github