2017 © Pedro Peláez
 

library eventbrite

A PHP library to provide interactions with the Eventbrite API.

image

jamiehollern/eventbrite

A PHP library to provide interactions with the Eventbrite API.

  • Tuesday, November 1, 2016
  • by jamiehollern
  • Repository
  • 5 Watchers
  • 16 Stars
  • 6,011 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 7 Forks
  • 1 Open issues
  • 4 Versions
  • 15 % Grown

The README.md

Eventbrite PHP

Deprecated! This project contains bugs and is no longer actively maintained. Use at your own risk.

A lightweight PHP wrapper for the Eventbrite API v3 using Guzzle 6., (*1)

Build Status Coverage Status Scrutinizer Code Quality Total Downloads Latest Stable Version License, (*2)

Requirements

  • PHP >= 5.5
  • cURL if you don't want any extra config (see the Guzzle docs)

Installation

Install via Composer command:
composer require jamiehollern/eventbrite, (*3)

Install via composer.json:, (*4)

{
  "require": {
    "jamiehollern/eventbrite": "1.0.1"
  }
}

Once you've done this:, (*5)

  • Run composer install
  • Add the autoloader to your script require_once('vendor/autoload.php')

Authentication

This API does not deal with the OAuth authentication flow. It assumes that your app has already been authenticated and that you have an OAuth token for any accounts you're going to use. It is this OAuth token that should be passed to the class on instantiation., (*6)

You can find out more about the Eventbrite authentication process on the Eventbrite API docs. If you only have a single app to authenticate you can simply get a premade OAuth token by adding an app on your Eventbrite apps page., (*7)

Examples

Instantiating the class

Basic usage

To get started, you only need an OAuth token to pass into the Eventbrite class:, (*8)


You can check that everything's working okay by running:, (*9)

canConnect();

?>

Advanced options

You can take advantage of the fact that this library is a fairly light wrapper around Guzzle if you need more advanced options while connecting., (*10)

To increase the timeout limit from the default 30 seconds to 60 seconds:, (*11)

 60]);

?>

If you don't have cURL installed, you can add a different HTTP request handler when instantiating the class. See the Guzzle docs for more information., (*12)

 $stack]);

?>

Making requests

There are three ways of making requests with the library and all of them roughly amount to the same thing, but with various levels of abstraction:, (*13)

  • makeRequest
  • call
  • get/post/put/patch/delete

Each of the following examples make the same call, using Eventbrite expansions., (*14)

The makeRequest method

This method is a wrapper around the call method and differs only in the parameters it takes. It is designed to be slightly more obvious than call in that the parameters explicitly outline what to do with the method., (*15)

makeRequest('GET', 'users/me/orders/', ['expand' => 'event.venue']);

?>

The shortcut methods

The shortcut methods are simply methods named for the HTTP verbs and are identical to the makeRequest method but for the fact that the first parameter of makeRequest is the actual name of the shortcut method. The methods available are get, post, put, patch and delete., (*16)

get('users/me/orders/', ['expand' => 'event.venue']);

?>

The call method

The call method is the most lightweight wrapper around the Guzzle client and takes three parameters; the HTTP verb (i.e. GET, POST etc), the endpoint and an optional array config for the request that maps directly to the Guzzle request options., (*17)

call('GET', 'users/me/orders/', ['query' => ['expand' => 'event.venue']]);

?>

Responses

Successfull requests made to the API will return an array with the following information:, (*18)

  • Response code
  • Response headers
  • Response body

If the body content sent back is JSON (which is almost always will be with the Eventbrite API) then this will be decoded to a multidimensional array., (*19)

The library does this by taking a Guzzle response object and extracting the most pertinent data from it. This is useful enough for most requests but since the library is just a wrapper around Guzzle, if you wish you can request the full Guzzle response object instead by passing a false value for the parse_response parameter., (*20)

call('GET', 'users/me/orders/', ['parse_response' => false]);

?>

If you'd like the response object but also want the usual array or don't want to modify your requests, the library stores the last request for you., (*21)

call('GET', 'users/me/orders/');
// Get the response object.
$last_response = $eventbrite->getLastResponse();

?>

If you need the parsed data again you can parse the last response. Be advised that the parseResponse method expects an object that implements the Guzzle ResponseInterface, which will always be a Guzzle response object in this case., (*22)

call('GET', 'users/me/orders/');
// Get the response object.
$last_response = $eventbrite->getLastResponse();
// Parse the response.
$parsed_response = $eventbrite->parseResponse($last_response);

?>

FAQ

  • My calls aren't working and don't seem to be calling the correct endpoint. What's wrong? Make sure you don't put a slash / in front of your endpoint or you'll confuse Guzzle.
  • Is there more in depth documentation available? Not yet but as I develop the library I plan to write extensive documentation.
  • What is the roadmap for this library? Initially it will serve to be a lightweight abstraction around Guzzle focused on RESTful requests to the Eventbrite API but eventually the plan is to include data objects and heavier abstraction on a per endpoint basis for users who don't want to put too much effort into using the API manually. This will allow for both beginners and advanced users to find something valuable in the library.

The Versions

01/11 2016

dev-master

9999999-dev

A PHP library to provide interactions with the Eventbrite API.

  Sources   Download

GPL2

The Requires

 

The Development Requires

by Jamie Hollern

rest event eventbrite

11/06 2016

1.0.1

1.0.1.0

A PHP library to provide interactions with the Eventbrite API.

  Sources   Download

GPL2

The Requires

 

The Development Requires

by Jamie Hollern

rest event eventbrite

11/06 2016

dev-develop

dev-develop

A PHP library to provide interactions with the Eventbrite API.

  Sources   Download

GPL2

The Requires

 

The Development Requires

by Jamie Hollern

rest event eventbrite

13/05 2016

1.0.0

1.0.0.0

A PHP library to provide interactions with the Eventbrite API.

  Sources   Download

GPL2

The Requires

 

The Development Requires

by Jamie Hollern

rest event eventbrite