PHP code example of djeventplannerhub / djep-php-sdk
1. Go to this page and download the library: Download djeventplannerhub/djep-php-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
djeventplannerhub / djep-php-sdk example snippets
use DJEP\Client;
// Load your API key from environment variables (never hardcode keys)
$djep = new Client(getenv('DJEP_API_KEY'), getenv('DJEP_DOMAIN'));
// Check API status
$status = $djep->status();
echo $status->data->api_version;
// List upcoming events
$events = $djep->events->list(['status' => 'Booked', 'per_page' => 10]);
foreach ($events->data as $event) {
echo $event->event_type . ' on ' . $event->event_date . "\n";
}
// All follow the same pattern
$venues = $djep->venues->list();
$venue = $djep->venues->get(789);
$employees = $djep->employees->list();
$packages = $djep->packages->list();
$addons = $djep->addons->list();
$contacts = $djep->contacts->list();
$vendors = $djep->vendors->list();
$vendor = $djep->vendors->get(3456);
// Link a vendor to an event
$djep->vendors->linkToEvent(56789, 3456);
// List all payments company-wide
$payments = $djep->payments->list(['per_page' => 50]);
// Add a payment to an event
$result = $djep->payments->addToEvent(56789, 500.00, 'Credit Card', [
'processing_fee' => 15.00,
'comments' => 'Final payment',
]);
echo "Balance due: " . $result->data->balance_due;
// Get requests for an event
$songs = $djep->musicRequests->forEvent(56789);
// Add a music request
$djep->musicRequests->add(56789, 'Queen', 'Bohemian Rhapsody', 'MPL');
$djep->musicRequests->add(56789, 'ABBA', 'Dancing Queen', 'DED', 'For the bride');
// List available helpers
$helpers = $djep->bookingHelpers->list();
// Run a helper by unique_id (recommended)
$result = $djep->bookingHelpers->run(56789, 'book_event_1');
echo $result->data->log;
// Or by position index
$result = $djep->bookingHelpers->run(56789, null, 0);
// Check a single date
$avail = $djep->availability->check('09/15/2026');
if ($avail->data->available) {
echo $avail->data->employees->available . ' employees available';
}
// Check a date range (max 90 days)
$range = $djep->availability->range('09/01/2026', '09/30/2026');
foreach ($range->data->dates as $date) {
echo $date->date . ': ' . ($date->available ? 'Available' : 'Unavailable') . "\n";
}
// Website tools (form config, field labels, validation)
$rfiSettings = $djep->settings->websiteTools('request_info');
// Company settings
$company = $djep->settings->company();
// Custom field configuration
$fields = $djep->settings->customFields();
// Quick status change — returns old and new status
$result = $djep->events->updateStatus(56789, 'Booked');
echo $result->data->old_status . ' → ' . $result->data->new_status;
// Assign employee to position (1-15), with optional fee and role
$djep->events->assignEmployee(56789, 1, 48113, ['fee' => 500, 'role' => 'Lead DJ']);
$djep->events->assignEmployee(56789, 2, 48361, ['fee' => 350, 'role' => 'MC']);
// Unassign position 3
$djep->events->assignEmployee(56789, 3, 0);
// Update notes — pass any combination of note fields
$djep->events->updateNotes(56789, [
'comments' => 'AI Summary: Client wants 80s and 90s hits',
'next_action' => 'Send playlist proposal',
'next_action_date' => '08/15/2026',
]);
// Fetches all events across all pages
foreach ($djep->events->all(['status' => 'Booked']) as $event) {
echo $event->event_date . "\n";
}
// Works with any paginated resource
foreach ($djep->clients->all() as $client) {
echo $client->first_name . ' ' . $client->last_name . "\n";
}
use DJEP\Exceptions\AuthenticationException;
use DJEP\Exceptions\NotFoundException;
use DJEP\Exceptions\ValidationException;
use DJEP\Exceptions\ForbiddenException;
use DJEP\Exceptions\RateLimitException;
use DJEP\Exceptions\DJEPException;
try {
$event = $djep->events->get(99999);
} catch (AuthenticationException $e) {
// Invalid or missing API key (401)
echo "Auth error: " . $e->getMessage();
} catch (NotFoundException $e) {
// Resource not found (404)
echo "Not found: " . $e->getMessage();
} catch (ForbiddenException $e) {
// Insufficient permissions (403)
echo "Forbidden: " . $e->getMessage();
} catch (ValidationException $e) {
// Invalid parameters (400)
echo "Validation error: " . $e->getMessage();
} catch (RateLimitException $e) {
// Too many requests (429)
echo "Rate limited: " . $e->getMessage();
} catch (DJEPException $e) {
// Any other API error
echo "Error: " . $e->getMessage();
}