bigbluebutton/bigbluebutton-api-php
Official BigBlueButton API client for PHP (7.4+). Provides an easy, modern way to call BigBlueButton server endpoints, build and send API requests, and integrate meetings and recordings into your PHP apps with documented examples and samples.
Installation
composer require bigbluebutton/bigbluebutton-api-php:^2.3.1
Update your composer.json and run composer update.
Basic Configuration
Create a BigBlueButton client instance in your Laravel service provider or config file:
use BigBlueButton\BigBlueButton;
$bbb = new BigBlueButton([
'url' => env('BBB_URL', 'https://demo.bigbluebutton.org/bigbluebutton/'),
'secret' => env('BBB_SECRET', 'your-secret-key'),
]);
First Use Case: Create a Meeting
$meeting = $bbb->createMeeting([
'name' => 'Team Sync',
'meetingID' => 'team-sync-123',
'attendeePW' => 'password123',
'moderatorPW' => 'moderator123',
'record' => true,
]);
Verify the response with dd($meeting) to confirm meeting details.
New Feature: Insert Document
$documentId = $bbb->insertDocument([
'meetingID' => 'team-sync-123',
'document' => base64_encode(file_get_contents('path/to/document.pdf')),
'name' => 'Meeting Notes',
]);
src/BigBlueButton.php for core methods, including the new insertDocument method.src/Exceptions/ for error handling, especially for the new API endpoints.Create Meetings Dynamically
$meeting = $bbb->createMeeting([
'name' => 'Laravel Workshop',
'meetingID' => Str::uuid()->toString(),
'attendeePW' => Str::random(10),
'moderatorPW' => Str::random(10),
'record' => true,
'recordFormat' => 'mp4',
]);
Join a Meeting
$joinUrl = $bbb->getJoinUrl($meeting['meetingID']);
return redirect()->away($joinUrl);
End a Meeting
$bbb->endMeeting($meeting['meetingID']);
Insert a Document into a Meeting
$document = base64_encode(file_get_contents('path/to/document.pdf'));
$documentId = $bbb->insertDocument([
'meetingID' => $meeting['meetingID'],
'document' => $document,
'name' => 'Project Requirements',
'description' => 'Discussion notes for the project',
]);
List Documents in a Meeting
$documents = $bbb->getMeetingDocuments($meeting['meetingID']);
foreach ($documents as $doc) {
// Process or display document metadata
}
List Users in a Meeting
$users = $bbb->getMeetingUsers($meeting['meetingID']);
foreach ($users as $user) {
// Log or process user data
}
Mute/Unmute Users
$bbb->muteUser($meeting['meetingID'], $userId, true); // Mute
$bbb->muteUser($meeting['meetingID'], $userId, false); // Unmute
Configure webhooks in your Laravel app to handle BBB events:
// In your BBB config
$bbb->setWebhookUrl(route('bbb.webhook'));
// In your routes file
Route::post('/bbb/webhook', [BbbWebhookController::class, 'handle']);
List Recordings
$recordings = $bbb->getRecordings();
foreach ($recordings as $recording) {
if ($recording['recorded']) {
$playbackUrl = $bbb->getPlaybackUrl($recording['recordId']);
}
}
Delete a Recording
$bbb->deleteRecording($recording['recordId']);
Laravel Service Provider Bind the BBB client to the container for dependency injection:
$this->app->singleton(BigBlueButton::class, function ($app) {
return new BigBlueButton([
'url' => config('bbb.url'),
'secret' => config('bbb.secret'),
]);
});
Queue Delayed Actions For long-running tasks (e.g., document processing), use Laravel queues:
dispatch(new ProcessDocumentJob($documentId, $meetingId));
Rate Limiting Implement middleware to throttle BBB API calls:
Route::middleware(['throttle:10,1'])->group(function () {
Route::post('/bbb/webhook', [BbbWebhookController::class, 'handle']);
});
Secret Key Validation
secret key. Ensure it matches the server’s key.403 Forbidden or malformed responses may indicate a mismatched secret.config('bbb.secret') and regenerate it if needed.Meeting ID Collisions
meetingID without ending the previous meeting will fail.meeting- . now()->format('YmdHis')) for IDs.Webhook Signature Verification
Signature header for webhooks. Always verify it:public function validateWebhook(array $payload) {
$expectedSignature = hash_hmac(
'sha1',
$payload['payload'],
config('bbb.secret')
);
if (!hash_equals($request->header('Signature'), $expectedSignature)) {
abort(403, 'Invalid webhook signature');
}
}
Rate Limits
429 Too Many Requests gracefully:try {
$bbb->createMeeting($data);
} catch (BigBlueButtonException $e) {
if ($e->getCode() === 429) {
sleep(2); // Retry after delay
retry();
}
throw $e;
}
Document Size Limits
URL Builder Fix (2.3.1)
urlBuilder property was fixed in this release. Ensure your custom configurations align with the updated structure if you previously extended the class.Enable Debugging
Set the debug option in the BBB client:
$bbb = new BigBlueButton([
'url' => config('bbb.url'),
'secret' => config('bbb.secret'),
'debug' => true, // Logs requests/responses
]);
Check Laravel logs for raw API interactions.
Test with Demo Instance Use the BBB demo server for testing:
$bbb = new BigBlueButton([
'url' => 'https://demo.bigbluebutton.org/bigbluebutton/',
'secret' => 'your-demo-secret', // Check BBB docs for demo secrets
]);
Custom Exceptions
Extend the BigBlueButtonException class to handle domain-specific errors:
class BbbDocumentException extends BigBlueButtonException {}
API Response Wrappers Create a decorator for responses to standardize data, including document metadata:
class BbbDocumentDecorator {
public static function decorate(array $document) {
return [
'id' => $document['documentId'],
'name' => $document['name'],
'meeting_id' => $document['meetingID'],
'uploaded_at' => $document['uploadTime'],
'download_url' => route('bbb.download', $document['documentId']),
];
}
}
Event Dispatching for Documents Trigger Laravel events for document-related actions:
$documentId = $bb
How can I help you explore Laravel packages today?