PHP library for PlanetHoster API
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 | phpTo install the library, enter the following command in your PHP project directory:
composer require planethoster/planethoster-apiOr edit composer.json and add:
{
"require": {
"planethoster/planethoster-api": "^1.0"
}
}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.
<?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();
// ...- Gabriel Poulenard-Talbot for PlanetHoster