Skip to content

Hikingyo/php-ovh-api

Repository files navigation

Ovh PHP Api Client

This is a simple PHP client for the Ovh Api.

More information about API usage at first-steps-with-ovh-api

Ovh Api

This project is inspired by GitLab PHP API Client

Build Status Software License Packagist Downloads Latest Version

Installation

This version supports PHP 7.4 and above.

To get started, siply require the library using Composer:

You will also need to install packages that " provide" psr/http-client-implementation and psr/http-factory-implementation in order to have a working client.

$ composer require "hikingyo/php-ovh-api" "guzzlehttp/guzzle:^7.4" "http-interop/http-factory-guzzle:^1.2"

We are decoupled from any HTTP messaging client by using

You can visit HTTPlug for library users to get more information about installing HTTPlug related packages.

General API Usage

<?php
$client = new Hikingyo\Ovh\Client();
$client->setEndpoint('ovh-eu');

$time = $client->auth()->time();

// Some endpoint need authentication
// See https://docs.ovh.com/gb/en/api/first-steps-with-ovh-api/ to get your consumer key and secret
$client->authenticate('<your_application_key>', '<your_application_secret>', '<your_consumer_key>');

$domains = $client->domain()->list()

HTTP Client Factory

By providing a Hikingyo\Ovh\HttpClient\HttpClientFactory to the Hikingyo\Ovh\Client constructor, you can customize the HTTP client. For example, to customize the user agent:

$plugin = new Http\Client\Common\Plugin\HeaderSetPlugin([
    'User-Agent' => 'Foobar',
]);
$factory = new Hikingyo\Ovh\HttpClient\HttpClientFactory();
$factory->addPlugin($plugin);
$client = new Hikingyo\Ovh\Client($factory);

One can read more about HTTPlug plugins here.

Take a look around the API methods, and please feel free to report any bugs, noting our code of conduct.

Authors

Contributing

See the contributing guide for more information.

License

This project is under MIT license.

Code of Conduct

See the code of conduct for more information.