ritero/twitch-sdk
Ritero Twitch SDK provides Laravel and PHP developers with a simple wrapper for Twitch API integration, including OAuth authentication and convenient access to users, streams, channels, and related endpoints for building Twitch-powered applications.
This is a generic PHP SDK, not a Laravel package — there is no service provider, facade, or config file to publish. Treat it as an HTTP wrapper you wire into the framework yourself.
composer require ritero/twitch-sdk:"dev-master#<commit-sha>"
If Packagist resolution fails, add a vcs repository entry in composer.json pointing at https://github.com/jofner/Twitch-SDK.README and the top-level SDK class first — everything is driven from a single client object constructed with your Twitch credentials. Check composer.json for the supported PHP version and the Guzzle constraint before assuming it installs on your stack..env (TWITCH_CLIENT_ID, TWITCH_CLIENT_SECRET).php artisan tinker session that instantiates the client and calls the "get top streams" / "get game" endpoints, so you can see the raw response shape before committing to a wrapper.Because the package is unmaintained, first verify which Twitch API era it targets — likely the legacy Kraken API rather than Helix. If so, most endpoints will return 410 Gone or 404 against the live API, and you should budget for a rewrite rather than an integration.
Bind it as a singleton. Create a thin service provider that constructs the SDK client from config/services.php credentials and registers it in the container. This keeps the SDK's constructor out of your application code and gives you one place to swap it later.
$this->app->singleton(\Ritero\TwitchSdk\Client::class, fn ($app) => new \Ritero\TwitchSdk\Client(
config('services.twitch.client_id'),
config('services.twitch.client_secret'),
));
Wrap it in a repository/service. Never let controllers touch the SDK directly. An App\Services\Twitch\StreamService with methods like topStreams(int $limit) gives you an interface you can reimplement against Helix when this SDK finally breaks.
Cache aggressively. Twitch data is read-heavy and changes slowly relative to request volume. Wrap calls in Cache::remember() with short TTLs (30–120s for live data, hours for game/user metadata). This also shields you from the SDK's lack of built-in rate-limit handling.
Push bulk work to the queue. Any loop over channels/users should be a job, not inline — sequential SDK calls in a request will burn through rate limits (and the package does no throttling for you).
Normalize responses at the boundary. The SDK returns raw decoded arrays/objects. Map them into your own DTOs or Eloquent models immediately so upstream changes only break one class.
Token handling: if the SDK does not manage OAuth app-access-token refresh, add a small TwitchTokenProvider that caches the token in Redis and refreshes before expiry; inject it into your client factory.
composer.json and lock a working dependency set, or better, plan the Helix migration now.NOASSERTION. That means the actual licensing terms are unclear or non-standard. Get legal clarity before shipping in a commercial product — this is a real blocker, not a formality.HttpException — catch and translate them in your service layer so failures degrade gracefully (e.g. cached fallback for a stream list).GuzzleHttp\Client for timeout/retry middleware; otherwise you are stuck with default HTTP behavior, which is a common source of hanging requests in production.How can I help you explore Laravel packages today?