This repository contains an unofficial PHP wrapper for the Ow-API.
API resources and response examples are in the Official Documentation.
This library requires PHP v7.1 or higher.
Use the below code to install the wrapper:
composer require fnev-eu/ow-api-php
<?php
require 'vendor/autoload.php';
use \OwAPI\Client;
$client = new Client();
// Get profile data for player Ori#21337 (it's me!),
$response = $client->profile(Client::PLATFORMS['PC'], Client::REGIONS['EU'], 'Ori#21337');
// Read the response
if ($response->isSuccess()) {
echo $response->getBody()['name'];
}
// Other available methods:
// - ALL profile data, heavy endpoint
$completeStats = $client->completeStats(Client::PLATFORMS['PC'], Client::REGIONS['EU'], 'Ori#21337');
// - Get profile data for specific heroes:
$heroesStats = $client->heroes(
Client::PLATFORMS['PC'],
Client::REGIONS['EU'],
'Ori#21337',
['brigitte', 'mercy', 'ana']
);
The profile
, completeStats
and heroes
method will return a Response
with the following methods:
isSuccess
: returns a boolean indicating if the API call was successfulgetStatus
: HTTP status codegetBody
: PHP associative array from the JSON responsegetRequest
andgetRawResponse
to help you for debug
Feel free to ask anything and contribute:
- Fork the project
- Create a new branch
- Implement your idea or fix
- Commit, push and open a pull request!