A simple API for integrating with the simple Albion gameinfo Web API.
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.
- PHP 7.0+
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
->first() as these methods actually return the data back to the caller.
$client = $albion->gameInfoClient(); $data = $client->recentEvents()->get();
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.
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.
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.
Accessed via the
->gameInfoClient() off of the AlbionApi, this client provides access to the following plugins,
This section will contain the available methods that can be found within a specific plugin.
!!! WIP !!!
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'.
Under construction, please check back soon