Eventbrite API wrapper for Laravel. This package provides a simple interface to Eventbite's (awesome) API. Organize Eventbrite integration with expressive, clean PHP.
PHP >= 7.2
Laravel >= 6.0
Laravel Eventbrite uses composer to make installation a breeze.
Install via composer
composer require marat555/eventbrite
Register service provider
Add the Laravel Eventbrite service provider to your config/app.php
file in the providers key
'providers' => [
// ... other providers
Marat555\Eventbrite\EventbriteServiceProvider::class,
]
Eventbrite facade alias
Then add the Eventbrite
facade to your aliases
key: 'Eventbrite' => Marat555\Eventbrite\Facades\Eventbrite::class.
Configuration can be done via your .env
file.
EVENTBRITE_BASE_URL=https://www.eventbriteapi.com/v3/
EVENTBRITE_TOKEN=xxxxxxx
You may also publish the config file to
config/eventbrite.pzhp
for editing:php artisan vendor:publish --provider="Marat555\Eventbrite\EventbriteServiceProvider"
Laravel Eventbrite is incredibly intuitive to use.
Already configured everything and just want to see it in action? Take a look at the example code below.
<?php
namespace App\Http\Controllers;
use Eventbrite;
use App\Http\Controllers\Controller;
class EventbriteController extends Controller
{
public function getEvent(int $eventId)
{
return response()->json(Eventbrite::event()->get($eventId));
}
}
Eventbrite::event()->get($eventId);
Eventbrite::event()->create(int $organizerId, array $event);
Eventbrite::event()->update(int $eventId, array $event);
Eventbrite::event()->list('venue', int $venueId, array $filterParams = []);
Eventbrite::event()->list('organizations', int $organizationId, array $filterParams = []);
Eventbrite::event()->list('series', int $seriesId, array $filterParams = []);
Eventbrite::event()->publish(int $eventId);
Eventbrite::event()->unpublish(int $eventId);
Eventbrite::event()->cancel(int $eventId);
Eventbrite::event()->delete(int $eventId);
Eventbrite::category()->get(int $categoryId);
Eventbrite::category()->all(int $categoryId);
Eventbrite::subcategory()->get(int $subcategoryId);
Eventbrite::subcategory()->all(int $categoryId);
Eventbrite::displaySettings()->get(int $eventId);
Eventbrite::displaySettings()->update(int $eventId, array $displaySettings);
Eventbrite::user()->get($userId);
Eventbrite::user()->me();
Eventbrite::venue()->get($venueId);
Eventbrite::venue()->create(int $organizerId, array $venue);
Eventbrite::venue()->update(int $venueId, array $venue);
Eventbrite::venue()->list(int $organizationId);
Eventbrite::format->get($formatId);
Eventbrite::format->list();
Eventbrite::media->get($formatId);
Eventbrite::media->createUpload(array $mediaUpload);
Eventbrite::media->createUpload(array $mediaUploadType);
The wrapper also provides a convenient way for you to build fairly elaborate Eventbrite API requests. The following methods return the instance so you can chain more constraints onto the request as required.
Eventbrite has many models that refer to each other, and often you’ll want to fetch related data along with the primary model you’re querying - for example, you’ll want to fetch an event along with organizer.
Eventbrite::event()->expand('organizer')->get($eventId);
The Eventbrite API will return errors as required. I am still looking for a nicer way to handle these exceptions... For the time being, simply wrap your call in a try/catch block.
try {
Eventbrite::event()->publish(1234);
} catch(EventbriteErrorException $e) {
$response = $e->getResponse();
$responseBodyAsString = $response->getBody()->getContents();
echo $responseBodyAsString;
}
- Event
- get
- create
- update
- list
- byEventSeriesId
- byVenueId
- byOrganizationId
- publish
- unpublish
- cancel
- delete
- Category
- get
- list
- Subcategory
- get
- list
- Display Settings
- getByEventId
- update
- User
- get
- me
- Venue
- get
- update
- list
- Format
- get
- list
- Media
- get
- createUpload
- createUpload
The Eventbrite API is extensive. I've attempted to cover all of the key endpoints but there are endpoints that are currently unimplemented.
The MIT License (MIT). Please see License File for more information.