ecn/riftconnector
最新稳定版本:v0.1.1
Composer 安装命令:
composer require ecn/riftconnector
包简介
Establishes connection to the RIFT chatserver API
README 文档
README
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(); }
统计信息
- 总下载量: 22
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-09-01