nicklaw5/twitch-api-php
PHP client library for the Twitch API. Includes easy methods for Helix and legacy endpoints, OAuth authentication flows, and request helpers to fetch streams, users, channels, videos, clips, and more. Useful for building Twitch integrations in PHP apps.
nicklaw5/twitch-auth-php), which can be integrated with Laravel’s Passport or Sanctum for unified auth flows.reactphp/event-loop) or custom implementations.composer require nicklaw5/twitch-api-php.Http client or Guzzle (if configured separately).twitch-auth-php.$this->app->singleton(TwitchClient::class, function ($app) {
return new TwitchClient(config('services.twitch.client_id'), config('services.twitch.client_secret'));
});
.env (e.g., TWITCH_CLIENT_ID, TWITCH_CLIENT_SECRET).auth:twitch).dispatch(new FetchTwitchStreams)).Stream, User).spatie/twitch) or Guzzle versions.Log::debug($twitchClient->getLastResponse())).spatie/backoff).$streamer = Cache::remember("twitch:streamer:{$id}", now()->addHours(1), function () use ($twitchClient) {
return $twitchClient->getUsers([$id])->getFirst();
});
| Failure Scenario | Mitigation Strategy |
|---|---|
| Twitch API downtime | Implement fallback responses (e.g., cached data) or graceful degradation. |
| Rate limit exceeded | Use queues + exponential backoff; notify admins via Laravel notifications. |
| OAuth token expiration | Refresh tokens automatically (e.g., Laravel’s auth:refresh middleware). |
| Package abandonment | Fork the repo or migrate to an alternative (e.g., Spatie’s package). |
| PHP/Laravel version incompatibility | Pin versions in composer.json; test upgrades in staging. |
telescope to monitor Twitch API calls.laravel-debugbar for request/response inspection.How can I help you explore Laravel packages today?