dms/meetup-api-client
Unmaintained Meetup.com API client (Guzzle-based) supporting v3/v2 and legacy v1 endpoints. Offers key auth plus OAuth 1.0 and OAuth 2.0, and GET/POST/DELETE requests via command methods or magic __call.
Install the Package:
composer require dms/meetup-api-client
Note: Ensure your Laravel app uses PHP 7.0+ (compatible with Guzzle v3.x).
Configure Authentication: Choose one of the three auth methods and instantiate the client in a Laravel service provider or controller:
// Example: Key Authentication (simplest for testing)
$client = \DMS\MeetupApiClient\MeetupKeyAuthClient::factory([
'key' => config('services.meetup.key')
]);
Store credentials in .env:
MEETUP_KEY=your_api_key_here
First API Call:
Use the magic __call method for autocompletion (PHPStorm/IDE-friendly):
$rsvps = $client->getRsvps(['event_id' => '273456789']);
foreach ($rsvps as $rsvp) {
echo $rsvp['member']['name']; // Direct array access
}
Alternative: Use getCommand() for manual Guzzle control:
$command = $client->getCommand('GetRsvps', ['event_id' => '273456789']);
$response = $command->execute();
Laravel Integration:
Bind the client to the container in AppServiceProvider:
$this->app->singleton('meetup', function ($app) {
return \DMS\MeetupApiClient\MeetupKeyAuthClient::factory([
'key' => $app['config']['services.meetup.key']
]);
});
Access via dependency injection:
public function __construct(private MeetupKeyAuthClient $meetup) {}
Fetch and cache event data for a group:
$events = $client->getEvents(['group_id' => '1234567', 'status' => 'upcoming']);
$events->setCacheTTL(3600); // Cache for 1 hour (custom extension)
Laravel Tip: Store responses in Laravel’s cache:
cache()->put("meetup_events_{$groupId}", $events, now()->addHours(1));
Track user RSVPs for analytics:
$rsvps = $client->getRsvps(['event_id' => '273456789']);
$attendees = collect($rsvps)->pluck('member.name')->toArray();
Laravel Tip: Sync with a users_events pivot table:
$user->events()->attach($eventId, ['rsvp_status' => $rsvp['response']]);
Fetch member profiles for community features:
$member = $client->getMember(['member_id' => '12345']);
$memberData = [
'name' => $member['name'],
'bio' => $member['bio'] ?? '',
'joined' => $member['joined'] ?? null,
];
Bulk operations with throttling:
$client = MeetupKeyAuthClient::factory([
'key' => 'your_key',
'rate_limit_factor' => 0.8, // Throttle at 80% of limit
]);
Create a MeetupService to encapsulate logic:
namespace App\Services;
class MeetupService {
public function __construct(private MeetupKeyAuthClient $client) {}
public function getUpcomingEvents(string $groupId): array {
$events = $this->client->getEvents([
'group_id' => $groupId,
'status' => 'upcoming',
'desc' => true,
]);
return collect($events)->map(fn ($event) => [
'id' => $event['id'],
'name' => $event['name'],
'time' => $event['time'] ?? null,
])->values()->toArray();
}
}
Convert API responses to Eloquent models:
$event = $client->getEvent(['event_id' => '273456789']);
return Event::updateOrCreate(
['meetup_id' => $event['id']],
[
'name' => $event['name'],
'description' => $event['description'],
'starts_at' => Carbon::parse($event['time']),
]
);
Offload heavy operations to queues:
SyncEventsJob::dispatch($groupId)
->onQueue('meetup');
Job implementation:
public function handle() {
$events = $this->meetup->getEvents(['group_id' => $this->groupId]);
// Process events...
}
Cache responses with Laravel’s cache:
$cacheKey = "meetup_events_{$groupId}";
return cache()->remember($cacheKey, now()->addHours(2), function () use ($client, $groupId) {
return $client->getEvents(['group_id' => $groupId]);
});
Centralize API error handling:
try {
$response = $client->getRsvps(['event_id' => $eventId]);
} catch (\DMS\MeetupApiClient\Exception\ApiException $e) {
Log::error("Meetup API Error: {$e->getMessage()}");
throw new \RuntimeException('Failed to fetch RSVPs', 0, $e);
}
Poll for updates and trigger Laravel events:
$lastUpdated = cache()->get("meetup_last_updated_{$groupId}");
$events = $client->getEvents([
'group_id' => $groupId,
'updated_after' => $lastUpdated,
]);
if ($events->count()) {
cache()->put("meetup_last_updated_{$groupId}", now());
event(new MeetupEventsUpdated($events));
}
Use Laravel Passport for OAuth flows:
// Redirect user to Meetup OAuth
return redirect($client->getAuthorizationUrl([
'redirect_uri' => route('meetup.callback'),
]));
// Handle callback
$token = $client->getAccessToken($request->query);
$client->setAccessToken($token);
Mock the client in tests:
$mockClient = Mockery::mock(\DMS\MeetupApiClient\MeetupKeyAuthClient::class);
$mockClient->shouldReceive('getEvents')
->once()
->andReturn(new \DMS\MeetupApiClient\Response\MultiResultResponse([...]));
$this->app->instance('meetup', $mockClient);
Guzzle Version Conflict:
composer.json:
"require": {
"guzzlehttp/guzzle": "3.9.5"
}
Rate Limiting Overhead:
rate_limit_factor (0.5) may cause unnecessary delays.$client = MeetupKeyAuthClient::factory([
'key' => 'your_key',
'rate_limit_factor' => 0.9, // Throttle only when near limit
]);
Deprecated Methods:
getEverywhereEvents (Meetup Everywhere) are removed but may still appear in IDE autocompletion.Response Data Structure:
data_get() for deep access:
$venue = data_get($event, 'venue.address.1');
Timezone Handling:
$eventTime = Carbon
How can I help you explore Laravel packages today?