spatie/twitter-labs
ReactPHP-powered PHP client for Twitter Developer Labs realtime endpoints, focused on the new filtered stream API as legacy streaming is deprecated. Works without deep React knowledge but integrates with event loops; easy migration from spatie/twitter-streaming-api.
Pros:
twitter-streaming-api), easing migration.Cons:
tweets/search/recent).php artisan queue:work) or Lumen for lightweight async processing.Spatie\Async\Async or custom event loop wrappers).tweetings/laravel-twitter-api) as a backup.abraham/twitteroauth)?twitter-streaming-api).twitter-streaming-api with this package).spatie/async or custom event loop).use Spatie\TwitterLabs\TwitterLabs;
use React\EventLoop\Factory;
$loop = Factory::create();
$twitter = new TwitterLabs($loop, 'API_KEY');
$twitter->stream('statuses/filter', ['track' => 'laravel'], function ($tweet) {
// Process tweet (sync or async)
});
$loop->run();
use Illuminate\Support\Facades\Bus;
$loop->addPeriodicTimer(1, function () {
Bus::dispatch(new ProcessTweet($tweet));
});
react/http).react/event-loop, react/http, and guzzlehttp/guzzle (for sync fallback).spatie/async).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Twitter Labs API deprecation | Broken streams, data loss | Migrate to Twitter API v2 |
| Stream disconnection | Missed tweets | Implement reconnection logic + dead-letter queue |
| ReactPHP event loop crash | Worker process failure | Supervisor (e.g., supervisord) + health checks |
| Database write failures | Data loss | Retry with exponential backoff |
| Rate limiting | Throttled requests | Implement queue delays + caching |
How can I help you explore Laravel packages today?