Skip to content
Access the Heartbeat Content Hub Partner APIs with this easy to use PHP SDK.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test
.gitignore
.travis.yml
LICENSE
README.md
composer.json
composer.lock
travis.phpunit.xml

README.md

Heartbeat Partner API SDK

Access the Heartbeat Content Hub Partner APIs with this easy to use PHP SDK.

Build Status Latest Stable Version Test Coverage Maintainability Total Downloads License

Installation

In order to use this library composer is required.

composer require heartbeat/sdk-partner-api

Usage

Examples how to use the Heartbeat SDK. For each request you need a valid Client object holding the access key:

$client = new Client('ACCESS_TOKEN');

Events

Usage examples to get the latest events and display informations:

// create the client object with the access token
$client = new \Heartbeat\Client('MY_ACCESS_TOKEN');

// foreach events and display related data including pois
foreach (\Hearbeat\EventDate::findAll($client) as $date) {

    // display the event date related informations
    echo $date->start_timestamp;
    echo $date->end_timestamp;

    // display the related event for this date:
    echo $date->event->title;
    echo $date->event->description;

    // as an event can have multiple pois iterator trough pois and display infos
    foreach ($date->event->pois as $poi) {
        echo $poi->title;
        echo $poi->street_combined;
        echo $poi->city;
        echo $poi->zip;
    }
}

POIS

An example to collect pois

// create the client object with the access token
$client = new \Heartbeat\Client('MY_ACCESS_TOKEN');

// foreach trough pois, limited by pages.
foreach (\Heartbeat\Poi::findAll($client) as $poi) {
    echo $poi->title;
    echo $poi->id;
}

Get all events and openinghours for a given POI id 1337:

// create the client object with the access token
$client = new \Heartbeat\Client('MY_ACCESS_TOKEN');

$poi = \Heartbeat\Poi::find()->viewOne(1337);

if (!$poi) {
    throw new \Exception("Unable to find the given POI id");
}

foreach ($poi->eventDates as $date) {
    echo $date->start_timestamp;
}

Streams

Accessing stream data:

foreach (\Heartbeat\Stream::findItems('stream-alias', $client) as $item) {
    echo $item->id;
}
You can’t perform that action at this time.