These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

iveeCrest: A PHP library for CREST (beta)

Author
Aineko Macx
#1 - 2015-02-26 18:01:58 UTC  |  Edited by: Aineko Macx
I present iveeCrest, a PHP library for EVE Online's CREST API.

Purpose and target audience

The goal of this project is to provide its users with a simple but powerful library to access EVE's CREST API. By hiding the complexities and some of the quirks of CREST, iveeCrest helps developers to quickly prototype scripts or develop full blown (web) applications. iveeCrest will likely be most useful for developers with at least basic PHP knowledge.

FEATURES

This is a beta release. Both CREST and this library are unfinished, so significant changes should be expected with time.

  • Object oriented design with high power-to-weight ratio
  • Authenticated CREST based
  • Methods for all endpoints reachable from CREST root are available, plus a few deeper endpoints. Easily expanded to support more (pull requests welcome!)
  • Gathering of multipage responses
  • Supports parallel GET requests with high performance asynchronous processing (>100 reqs/second possible)
  • Multilayer cache design, supporting Memcached or Redis as caching backend
  • The index-less collections returned by CREST are properly re-indexed by IDs
  • Extensible via configurable subclassing
  • A well documented and mostly PSR compliant codebase
  • Includes a self-contained web-script to retrieve a refresh token

Released as open source under the LGPL.

USAGE

Basic usage is shown with some examples:
//initialize iveeCrest. Adapt path as required.
require_once('/path/to/iveeCrest/iveeCrestInit.php');

//instantiate the CREST client, passing the configured options
$client = new iveeCrest\Client(
    iveeCrest\Config::getCrestBaseUrl(),
    iveeCrest\Config::getClientId(),
    iveeCrest\Config::getClientSecret(),
    iveeCrest\Config::getUserAgent(),
    iveeCrest\Config::getClientRefreshToken()
);
//instantiate an endpoint handler
$handler = new iveeCrest\EndpointHandler($client);

//show response data from verifyAccessToken call
print_r($handler->verifyAccessToken());

//get regions endpoint
print_r($handler->getRegions());

//get specific region endpoint
print_r($handler->getRegion(10000002));

//gather all item groups (multipage response is gathered automatically)
print_r($handler->getItemGroups());

//get all market orders for Tritanium in The Forge
print_r($handler->getMarketOrders(34, 10000002));

To help with the understanding of the structuring of the library, a class diagram is provided.

DOWNLOAD

The repository and full readme can be found here:
https://github.com/aineko-m/iveeCrest

Feedback welcome!
Aineko Macx
#2 - 2015-02-26 18:02:45 UTC
Drachiel
Mercury LLC
#3 - 2015-03-11 19:53:34 UTC
Pulled in just the refresh token maker, and it seems to not work properly, in that Chrome gives a white screen upon redirect, and IE gives an HTTP 500. That's immediately after character select and the authorize button. IE's address bar still show's CCP's domain, while Chrome's shows the server's. Double checked callback, client, secret, checked for spaces at beginning/end of any, etc.
Aineko Macx
#4 - 2015-03-12 07:35:11 UTC
I checked with IE and Chrome as well as Firefox under Linux and Windows and was unable to replicate the issue. I'm afraid without being able to debug your setup I can only take shots in the dark. If even CCP's site doesn't redirect you properly back to the script, I suspect something is wrong with your callback URL / domain. I'm assuming you did check that the callback you set for the app and the one you put into the form match?
Drachiel
Mercury LLC
#5 - 2015-03-16 16:03:42 UTC
Might be the server then. Curl is running though ... maybe my htaccess is unhappy concerning incoming redirects? I'll do some digging.