PHP code example of bmlt-enabled / bmlt-php-query-client
1. Go to this page and download the library: Download bmlt-enabled/bmlt-php-query-client 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/ */
bmlt-enabled / bmlt-php-query-client example snippets
use BmltEnabled\BmltQueryClient\Client\BmltClient;
use BmltEnabled\BmltQueryClient\Types\VenueType;
use BmltEnabled\BmltQueryClient\Types\Weekday;
// Initialize the client
$client = new BmltClient(
rootServerUrl: 'https://latest.aws.bmlt.app/main_server' // NYC demo server
);
// Search for meetings
$meetings = $client->searchMeetings([
'venue_types' => VenueType::VIRTUAL->value,
'page_size' => 10,
]);
foreach ($meetings as $meeting) {
echo "Meeting: {$meeting->meeting_name}\n";
echo "Time: {$meeting->start_time}\n";
if ($meeting->virtual_meeting_link) {
echo "Link: {$meeting->virtual_meeting_link}\n";
}
echo "---\n";
}
$client = new BmltClient(
rootServerUrl: 'https://your-server.org/main_server', // Required
defaultFormat: BmltDataFormat::JSON, // Optional
timeout: 30, // Request timeout in seconds
userAgent: 'my-app/1.0.0', // Custom user agent
enableGeocoding: true, // Enable geocoding features
);
// Basic search
$meetings = $client->searchMeetings([
'weekdays' => [Weekday::SUNDAY->value, Weekday::MONDAY->value],
'venue_types' => VenueType::IN_PERSON->value,
'page_size' => 20,
]);
// Search by coordinates
use BmltEnabled\BmltQueryClient\Types\Coordinates;
$coordinates = new Coordinates(40.7580, -73.9855); // Times Square
$nearbyMeetings = $client->searchMeetingsByCoordinates(
$coordinates,
radiusMiles: 5.0,
searchParams: ['page_size' => 10]
);
// Search by address (uses geocoding)
$addressMeetings = $client->searchMeetingsByAddress(
address: 'Times Square, New York, NY',
radiusMiles: 2.0,
sortByDistance: true,
searchParams: ['venue_types' => VenueType::VIRTUAL->value]
);
// Get server info
$serverInfo = $client->getServerInfo();
echo "Version: {$serverInfo->version}\n";
echo "Languages: " . implode(', ', $serverInfo->langs ?? []) . "\n";
// Get meeting formats
$formats = $client->getFormats();
foreach ($formats as $format) {
echo "{$format->key_string}: {$format->name_string}\n";
}
// Get service bodies
$serviceBodies = $client->getServiceBodies();
foreach ($serviceBodies as $serviceBody) {
echo "{$serviceBody->name} ({$serviceBody->type})\n";
}
// Geocode an address
$result = $client->geocodeAddress('Central Park, New York, NY');
echo "Coordinates: {$result->coordinates->latitude}, {$result->coordinates->longitude}\n";
echo "Address: {$result->display_name}\n";
// Reverse geocode coordinates
$coordinates = new Coordinates(40.7614, -73.9776);
$address = $client->reverseGeocode($coordinates);
echo "Address: {$address->display_name}\n";
use BmltEnabled\BmltQueryClient\Client\{MeetingQueryBuilder, QuickSearch};
// Complex fluent query
$eveningVirtual = (new MeetingQueryBuilder($client))
->virtualOnly()
->startingAfter(17, 0) // After 5 PM
->endingBefore(21, 0) // Before 9 PM
->onWeekdays(Weekday::MONDAY, Weekday::FRIDAY)
->paginate(10)
->execute();
// Quick search patterns
$quickSearch = new QuickSearch($client);
$todaysMeetings = $quickSearch->today()->execute();
$tonightVirtual = $quickSearch->tonight()->virtualOnly()->execute();
$weekendInPerson = $quickSearch->weekend()->inPersonOnly()->execute();
// Geographic search with fluent interface
$nearbyMeetings = (new MeetingQueryBuilder($client))
->inPersonOnly()
->morning()
->executeNearAddress('Times Square, NY', 2.0);
// Meeting properties
$meeting->id_bigint; // Meeting ID
$meeting->meeting_name; // Meeting name
$meeting->weekday_tinyint; // Day of week (1=Sunday)
$meeting->start_time; // Start time (HH:MM)
$meeting->venue_type; // 1=In-person, 2=Virtual, 3=Hybrid
$meeting->virtual_meeting_link; // Virtual meeting URL
$meeting->latitude; // Latitude
$meeting->longitude; // Longitude
$meeting->distance_in_miles; // Distance (when searching by location)
// ... and many more