dev-master
9999999-devWrapper for OVH APIs
BSD-3-Clause
The Requires
The Development Requires
by Vincent Cassé
1.0
1.0.0.0Wrapper for OVH APIs
BSD-3-Clause
The Requires
The Development Requires
by Vincent Cassé
Wrapper for OVH APIs
This PHP package is a lightweight wrapper for OVH APIs. That's the easiest way to use OVH.com APIs in your PHP applications., (*2)
get('/me')['firstname']; ?>
To download this wrapper and integrate it inside your PHP application, you can use Composer., (*4)
Add the repository in your composer.json file or, if you don't already have this file, create it at the root of your project with this content:, (*5)
{ "name": "Example Application", "description": "This is an example of OVH APIs wrapper usage", "require": { "ovh/ovh": "dev-master" } }
Then, you can install OVH APIs wrapper and dependencies with:, (*6)
php composer.phar install
This will install ovh/ovh
to ./vendor
, along with other dependencies
including autoload.php
., (*7)
To communicate with APIs, the SDK uses a token on each request to identify the user. This token is called Consumer Key. To have a validated Consumer Key, you need to redirect your user on specific authentication page. Once the user has logged in, the token is validated and user will be redirected on $redirection url., (*8)
'GET', 'path' => '/me*' ]); // Get credentials $conn = new Api($applicationKey, $applicationSecret, $endpoint); $credentials = $conn->requestCredentials($rights, $redirection); // Save consumer key and redirect to authentication page $_SESSION['consumer_key'] = $credentials["consumerKey"]; header('location: '. $credentials["validationUrl"]); ... ?>
get('/dedicated/server/'); foreach ($servers as $server) { // Search servers inside SBG1 $details = $conn->get('/dedicated/server/'. $server); if ($details['datacenter'] == 'sbg1') { // Activate burst on server $content = (object) array('status' => "active"); $conn->put('/dedicated/server/'. $server . '/burst', $content); echo "We burst " . $server; } } ?>
Documentation is based on phpdocumentor. To install it with other quality tools, you can install local npm project in a clone a project, (*9)
git clone https://github.com/ovh/php-ovh.git cd php-ovh php composer.phar install npm install
To generate documentation, it's possible to use directly:, (*10)
grunt default
Documentation is available in docs/ directory., (*11)
Tests are based on phpunit. To install it with other quality tools, you can install local npm project in a clone a project, (*12)
git https://github.com/ovh/php-ovh.git cd php-ovh php composer.phar install npm install
Edit phpunit.xml file with your credentials to pass functionals tests. Then, you can run directly unit and functionals tests with grunt., (*13)
grunt
Wrapper for OVH APIs
BSD-3-Clause
Wrapper for OVH APIs
BSD-3-Clause