hikingyo/php-ovh-api

Ovh API client for PHP

v0.1-alpha 2022-04-09 19:09 UTC

This package is auto-updated.

Last update: 2024-04-10 23:50:51 UTC


README

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 68747470733a2f2f636f6465636f762e696f2f67682f48696b696e67796f2f7068702d6f76682d6170692f6272616e63682f646576656c6f702f67726170682f62616467652e7376673f746f6b656e3d4d4342374f52535a4135

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.