Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Meetup Api Client Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Steps

  1. Install the Package:

    composer require dms/meetup-api-client
    

    Note: Ensure your Laravel app uses PHP 7.0+ (compatible with Guzzle v3.x).

  2. 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
    
  3. 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();
    
  4. 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) {}
    

Implementation Patterns

Core Workflows

1. Event Discovery

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));

2. RSVP Management

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']]);

3. Member Data

Fetch member profiles for community features:

$member = $client->getMember(['member_id' => '12345']);
$memberData = [
    'name' => $member['name'],
    'bio' => $member['bio'] ?? '',
    'joined' => $member['joined'] ?? null,
];

4. Rate-Limited Operations

Bulk operations with throttling:

$client = MeetupKeyAuthClient::factory([
    'key' => 'your_key',
    'rate_limit_factor' => 0.8, // Throttle at 80% of limit
]);

Laravel-Specific Patterns

1. Service Layer Abstraction

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();
    }
}

2. Response Transformation

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']),
    ]
);

3. Queueing API Calls

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...
}

4. Caching Strategies

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]);
});

5. Error Handling

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);
}

Advanced Patterns

1. Webhook Simulation

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));
}

2. OAuth Integration

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);

3. Testing

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);

Gotchas and Tips

Pitfalls

  1. Guzzle Version Conflict:

    • The package uses Guzzle v3.x, which may conflict with Laravel’s Guzzle v6/7.
    • Fix: Add a compatibility constraint in composer.json:
      "require": {
          "guzzlehttp/guzzle": "3.9.5"
      }
      
    • Alternative: Fork the package and update Guzzle dependencies.
  2. Rate Limiting Overhead:

    • The default rate_limit_factor (0.5) may cause unnecessary delays.
    • Tip: Adjust based on your API usage:
      $client = MeetupKeyAuthClient::factory([
          'key' => 'your_key',
          'rate_limit_factor' => 0.9, // Throttle only when near limit
      ]);
      
  3. Deprecated Methods:

    • Methods like getEverywhereEvents (Meetup Everywhere) are removed but may still appear in IDE autocompletion.
    • Tip: Check the Meetup API docs for active endpoints.
  4. Response Data Structure:

    • API responses may include nested arrays/objects. Use data_get() for deep access:
      $venue = data_get($event, 'venue.address.1');
      
  5. Timezone Handling:

    • Meetup returns timestamps in UTC. Convert to user timezone:
      $eventTime = Carbon
      
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor