ecn/riftconnector

This package is abandoned and no longer maintained. No replacement package was suggested.

Establishes connection to the RIFT chatserver API

v0.1.1 2015-09-01 17:35 UTC

This package is auto-updated.

Last update: 2022-03-09 08:36:39 UTC


README

Build Status

Installation

Install the RiftConnector via composer:

$ composer require ecn/riftconnector:0.1.*

Usage

The RiftConnector comes along with a RiftService class that allows easy access to shards, zones and events.

Setup

To get a running RiftService instance, pass a connector instance to the constructor:

<?php

use GuzzleHttp\Client;
use Ecn\RiftConnector\Connector;
use Ecn\RiftConnector\RiftService;

$connector = new Connector(new Client(), Connector::EU_SERVER);
$service = new RiftService($connector);
        

Retrieving shard data

To retrieve a shard object, use the getShard() method:

// returns a Shard object
$shard = $service->getShard('Brutwacht');
        

Retrieving zones

You can query zones from the shard object:

// returns an array of Zone objects
$zones = $shard->getZones();
        

Alternatively, you can retrieve zones directly from the RiftService:

// returns an array of Zone objects
$zones = $service->getZones('Brutwacht');
        

Retrieving events

Similar to zones, events can be retrieved from the shard object or from the RiftConnector directly:

// returns an array of Event objects
$events = $shard->getEvents();

// returns an array of Event objects
$events = $service->getEvents('Brutwacht');
        

Additionally, you can check a zone directly for an event:

$zones = $shard->getZones();
 
if ($zones[0]->hasEvent()) {
    $event = $zones[0]->getEvent();
}