PHP code example of ecn / riftconnector

1. Go to this page and download the library: Download ecn/riftconnector library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ecn / riftconnector example snippets




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

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


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


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


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


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

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


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