dmk1991/albion-online-php-api

A simple API for integrating with the simple Albion gameinfo Web API.

v0.1.1 2017-08-13 04:03 UTC

README

A simple PHP API for integrating with the Albion gameinfo Web API.

Documentation is currently a work in progress and will become more robust as time allows.

Requirements:

  • PHP 7.0+

Getting Started:

This section will go over a basic implementation of the Albion Online PHP API. For a more detailed review of specific clients and methods please skip ahead to the Clients section.

Begin by requiring the package using Composer. (If you do not wish to use Composer, you can always clone the GitHub repository.)

composer require dmk1991/albion-online-php-api 

Within a PHP file, pull in the full API and new up an instance.

use Albion\AlbionApi;
$albion = new AlbionApi();

From here we can now interact with any of the available package clients. For this example we will use the game info client. The package has been designed to allow for fluent chaining of methods off of a client. All method chains should end with either ->get() or ->first() as these methods actually return the data back to the caller.

$client = $albion->gameInfoClient();

$data = $client->recentEvents()->get();

or

$albion->gameInfoClient()->recentEvents()->get();

Clients

Clients are simply groupings of methods based on the current Albion Online web API. As of right now, the only web API that is available from Sandbox Interactive returns common game information such as player and guild stats, events, and a small ammount of PVP info. With this in mind, only one client currently exists to handle these requests. Methods are contained within Plugins and are associated with a specific endpoint. With all of the methods residing withing Plugins (PHP traits), users of this package are allowed a certain ammount of flexability if you wish to create your own client (see Custom Clients section).

In addition to the methods available via plugins, all clients have the following public methods.

get()

This is used to return the results of the request to the web api. This will return an array of PHP object represtations of the data. This method can only be used at the end of a chain.

first()

If the results of an API have more than one set of information youc an use the first() method to return only the very first object representation within the resulting array. This method can only be used at the end of a chain.

GameInfoClient

Accessed via the ->gameInfoClient() off of the AlbionApi, this client provides access to the following plugins,

  • SearchPlugin
  • PlayerPlugin
  • GuildPlugin
  • EventPlugin
  • ServerPlugin

Plugins

This section will contain the available methods that can be found within a specific plugin.

!!! WIP !!!

Search Plugin

search(array $parameters)

Used to retrieve information about players and guilds. The method accepts an array of key => value pairings of GET parameters and queries. Currenlty the only usable GET parameter that the Albion Online web API accepts is 'q'.

players()

guilds()

Player Plugin

playerInfo(string $playerId)

Guild Plugin

guildInfo(string $guildId)

guildData(string $guildId)

guildMembers(string $guildId)

guildStats(string $guildId)

guildTopKills(string $guildId, $parameters=[])

guildFued(string $guildId, string $secondGuildId)

EventPlugin

recentEvents($parameters=[])

eventDetails(int $eventId)

eventHistory(int $eventId, int $secondEventId)

Server Plugin

serverStatus()

Custom Clients

Under construction, please check back soon