示例#1
0
<?php

require_once 'sdk/hoist.php';
$hoist = new Hoist();
$new_invoice = function ($event, $payload) {
    print_r("New Invoice Event");
    print_r($payload);
    print_r($event);
};
$hoist->on("new:invoice", $new_invoice);
示例#2
0
<?php

require_once 'hoist.php';
require_once 'poller.php';
require_once 'logger.php';
/** 

Launcher for the Hoist poller.

**/
$hoist = new Hoist();
$hoistPoller = new HoistPoller($hoist->_api_key);
if (isset($argv[1]) && $argv[1] == "start") {
    $hoist->start();
}
if (isset($argv[2])) {
    //Require in the methods that the user has supplied
    require_once $argv[2];
    $hoistPoller->start($hoist->watchMethods);
}
示例#3
0
<?php

/**
  
   Copyright 2015 Hoist
   Sample Methods File
*/
require_once 'sdk/hoist.php';
$hoist = new Hoist();
/** 
	Watching an event and passing it a method 
*/
$new_invoice = function ($event, $payload) {
    print_r("New Invoice Event");
    print_r($payload);
};
$hoist->on("xero:invoice:new", $new_invoice);
/**
	Raising an event with an object payload
*/
$pl = array('name' => 'Nick', 'surname' => 'Doe', 'age' => 20);
$event_details = $hoist->raise("internal:event", $pl);
示例#4
0
<?php

require_once './sdk/hoist.php';
$hoist = new Hoist();
$pl = array('name' => 'Nick', 'surname' => 'Doe', 'age' => 20);
$internal = function ($event, $payload) {
    print_r("New Internal Event");
    print_r($payload);
};
$hoist->on("internal:event", $internal);
$eventDetails = $hoist->raise("internal:event", $pl);
print_r($eventDetails);
示例#5
0
<?php

require_once './sdk/hoist.php';
$hoist = new Hoist();
$url = $hoist->getBouncerURL("xero1");
print_r($url);