Skip to content

🎮 A light PHP wrapper for Ow-API, an unofficial API for Overwatch.

Notifications You must be signed in to change notification settings

florianorineveu/Ow-API-PHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ow-API (Overwatch API) PHP Wrapper

MIT License Current Version

Overview

This repository contains an unofficial PHP wrapper for the Ow-API.

API resources and response examples are in the Official Documentation.

Table of contents

Compatibility

This library requires PHP v7.1 or higher.

Installation

Use the below code to install the wrapper:

composer require fnev-eu/ow-api-php

How to use

Example

<?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 successful
  • getStatus: HTTP status code
  • getBody: PHP associative array from the JSON response
  • getRequest and getRawResponse to help you for debug

Contribute

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!