- Notifications
You must be signed in to change notification settings - Fork1
shiflett/eventbrite
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Instantiate the$eventbrite
object and declare the user and app keys:
$eventbrite = Eventbrite(array('user_key' => $userKey, 'app_key' => $appKey));
Although it's not recommended, you can use the user's email address and passwordinstead of the user's API key:
$eventbrite = Eventbrite(array('user' => 'chris@shiflett.org', 'password' => 'mypass', 'app_key' => $appKey));
This library caches by default, and you can indicate your preferences for whereto cache and for how long with thecache()
method. For example, to cache filesin/tmp
for one day (the default behavior):
$eventbrite->cache(array('dir' => '/tmp', 'timeout' => 86400));
If you want to disable caching, settimeout
to0
:
$eventbrite->cache(array('timeout' => 0));
Use the$eventbrite
object to access any of the API endpoints you want,passing all required and any optional arguments:
$attendees = $eventbrite->eventListAttendees(array('id' => '1514765705'));
Many responses are more than you need, but you can reformat them as desired. Forexample, here's what we do to create a simpler and more manageable array ofattendees for theBrooklyn Beta web site:
$original = $eventbrite->eventListAttendees(array('id' => '1514765705'));$attendees = array();foreach ($original['attendees'] as $attendee) { $attendee = $attendee['attendee']; $twitter = strtolower(trim($attendee['answers'][0]['answer']['answer_text'], ' @')); $attendees[$twitter] = array('name' => "{$attendee['first_name']} {$attendee['last_name']}", 'email' => $attendee['email'], 'blog' => $attendee['blog']);}