planethoster/planethoster-api

PHP library for PlanetHoster API

1.4.2 2023-05-23 18:07 UTC

This package is auto-updated.

Last update: 2024-04-08 09:12:54 UTC


README

PHP library for PlanetHoster API

CircleCI Latest Stable Version Total Downloads License

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

Support

Please open an issue in github

Resources

PlanetHoster API documentation