florianorineveu / ow-api-php
PHP wrapper for Ow-API
1.0.4
2024-03-26 22:14 UTC
Requires
- php: ^7.1|^8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- phpunit/phpunit: ^9.0
README
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 successfulgetStatus
: HTTP status codegetBody
: PHP associative array from the JSON responsegetRequest
andgetRawResponse
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!