2017 © Pedro Peláez
 

library crester

PHP library for interacting with the Eve Online CREST and XML APIs through a fluent, english-like interface.

image

wizofgoz/crester

PHP library for interacting with the Eve Online CREST and XML APIs through a fluent, english-like interface.

  • Tuesday, February 7, 2017
  • by Wizofgoz
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 7 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

Latest Stable Version Latest Unstable Version Total Downloads License, (*1)

CRESTer

Eve Online's CREST API Library using fluent, english-like syntax, (*2)

USAGE:

  1. Set configuration in src/Config files
    a. CREST.php - for setting configuration concerning how the library talks with the API
    b. Cache.php - for setting configuration concerning a cache that the library utilizes
  2. Initialize a Crester object
  3. Redirect to Eve Online SSO
  4. Handle Callback
  5. Make calls on returned object

Functions

Crester Class

redirect() - redirects visitor to Eve Online SSO for authentication
handleCallback($AuthCode, $State = '') - creates a Crest object and handles final authentication with API
fromRefreshToken($Token) - returns a Crest object authenticated by the given Refresh Token
crest() - returns the current connection to the CREST API
xml() - returns the current connection to the XML API
, (*3)

Crest Class

setAuthCode($AuthCode) - updates the connection's used Authorization Code and verifies it
getStatus() - returns true/false whether the connection is ready to make calls to the API
getToken() - returns the current token being used to make requests
getRefreshToken() - returns the current refresh token
getExpiration() - returns when the current token will expire
node($key, $value = NULL) - adds a node to the route to traverse down the API tree
get() - makes a GET call with the current route and returns the result as an array
post($data = []) - makes a POST call with the current route and given data key/values and returns the result as an array
put($data = []) - makes a PUT call with the current route and given data key/values and returns the result as an array
delete() - makes a DELETE call with the current route and returns the result as an array
verifyCode() - makes specialized call to verify Authorization Code (called automatically)
getCharacterInfo() - makes specialized call to retrieve information about the logged-in character
customCall($URL, $Method) - makes a call to the specified URL with the given method (GET, POST, PUT, DELETE)
, (*4)

XML Class

setToken($Token) - sets the access token to use when interacting with API (called automatically)
setKey($Key) - sets call to use API Key Authorization. $Key is an associative array with indexes "KeyID" and "VCode"
scope($Scope) - sets the scope of the call
endPoint($EndPoint) - sets the endpoint the call will use
accessType($AccessType) - sets the type of access the call will request. Only for CREST Authorization
get($Args = [], $Key = NULL) - makes the built call against the API. $Key is an alternate to using setKey() and uses the same syntax
clear() - clears the currently built call (called automatically by get())
, (*5)

Adding Nodes

Nodes that are added to specify the route that a call will use to reach it's destination can follow one of three formats:, (*6)

In Example 1 below, the first node added to the route uses a simple key search. In this case, after calling the base URL, CRESTer will search the returned json for a key called "constellations" and calls the URL in that item's "href"., (*7)

Also demonstrated in Example 1 is adding a key-value search node, shown by the second call to node(). In the example, the node is told to search for a key called "name" that has a value of "Joas"., (*8)

Example 1: Getting Information for a Constellation

Initialize the CRESTer object

$crester = new \Crester\Crester();

Make redirect to SSO

$crester->redirect();

Handle callback from SSO

$crest = $crester->handleCallback($_GET['code'], isset($_GET['state']) ? $_GET['state'] : '');

Define call using fluent interface syntax

$Joas = $crest->node('constellations')->node('name', 'Joas')->get();

View the results var_dump($Joas);

, (*9)

array(4) { 
    ["position"]=> array(3) { 
        ["y"]=> float(3.3836265012848E+16) 
        ["x"]=> float(-4.9173916281706E+16) 
        ["z"]=> float(-4.2057063709409E+16) 
    } 
    ["region"]=> array(1) { 
        ["href"]=> string(48) "https://crest-tq.eveonline.com/regions/10000001/" 
    } 
    ["systems"]=> array(7) { 
        [0]=> array(3) { 
            ["href"]=> string(53) "https://crest-tq.eveonline.com/solarsystems/30000112/" 
            ["id"]=> int(30000112) 
            ["id_str"]=> string(8) "30000112" 
        } 
        [1]=> array(3) { 
            ["href"]=> string(53) "https://crest-tq.eveonline.com/solarsystems/30000113/" 
            ["id"]=> int(30000113) 
            ["id_str"]=> string(8) "30000113" 
        } 
        [2]=> array(3) { 
            ["href"]=> string(53) "https://crest-tq.eveonline.com/solarsystems/30000114/" 
            ["id"]=> int(30000114) 
            ["id_str"]=> string(8) "30000114" 
        } 
        [3]=> array(3) { 
            ["href"]=> string(53) "https://crest-tq.eveonline.com/solarsystems/30000115/" 
            ["id"]=> int(30000115) 
            ["id_str"]=> string(8) "30000115" 
        } 
        [4]=> array(3) { 
            ["href"]=> string(53) "https://crest-tq.eveonline.com/solarsystems/30000116/" 
            ["id"]=> int(30000116) 
            ["id_str"]=> string(8) "30000116" 
        } 
        [5]=> array(3) { 
            ["href"]=> string(53) "https://crest-tq.eveonline.com/solarsystems/30000117/" 
            ["id"]=> int(30000117) 
            ["id_str"]=> string(8) "30000117" 
        } 
        [6]=> array(3) { 
            ["href"]=> string(53) "https://crest-tq.eveonline.com/solarsystems/30000118/" 
            ["id"]=> int(30000118) 
            ["id_str"]=> string(8) "30000118" 
        } 
    } 
    ["name"]=> string(4) "Joas" 
}

The Versions

07/02 2017

v0.2.6.x-dev

0.2.6.9999999-dev

PHP library for interacting with the Eve Online CREST and XML APIs through a fluent, english-like interface.

  Sources   Download

MIT

The Requires

 

07/02 2017

dev-master

9999999-dev

PHP library for interacting with the Eve Online CREST and XML APIs through a fluent, english-like interface.

  Sources   Download

MIT

The Requires

 

07/02 2017

v0.2.6

0.2.6.0

PHP library for interacting with the Eve Online CREST and XML APIs through a fluent, english-like interface.

  Sources   Download

MIT

The Requires

 

06/02 2017

dev-analysis-8wvjLN

dev-analysis-8wvjLN

PHP library for interacting with the Eve Online CREST and XML APIs through a fluent, english-like interface.

  Sources   Download

The Requires

 

29/01 2017

dev-dev

dev-dev

PHP library for interacting with the Eve Online CREST and XML APIs through a fluent, english-like interface.

  Sources   Download

The Requires

 

The Development Requires

13/01 2017

v0.2.5.x-dev

0.2.5.9999999-dev

PHP library for interacting with the Eve Online CREST and XML APIs through a fluent, english-like interface.

  Sources   Download

The Requires

 

13/01 2017

0.2.5

0.2.5.0

PHP library for interacting with the Eve Online CREST and XML APIs through a fluent, english-like interface.

  Sources   Download

The Requires

 

07/01 2017

dev-v0.2.4-alpha

dev-v0.2.4-alpha

PHP library for interacting with the Eve Online CREST and XML APIs through a fluent, english-like interface.

  Sources   Download

The Requires

 

07/01 2017

v0.2.4-alpha

0.2.4.0-alpha

PHP library for interacting with the Eve Online CREST and XML APIs through a fluent, english-like interface.

  Sources   Download

The Requires