nticaric / twitter-streaming-api
A PHP library for consuming Twitter’s Streaming API
v3.0
2018-12-06 14:41 UTC
Requires
- php: >=5.4.0
- guzzlehttp/guzzle: ^6.0
- guzzlehttp/oauth-subscriber: 0.3.*
- nesbot/carbon: ~1.0
Requires (Dev)
- mockery/mockery: ~0.9
- phpunit/phpunit: ~4.0
README
A PHP library for consuming Twitter’s Streaming API
##Instalation
The easiest way to install Twitter Streaming API is via composer. Create the following composer.json
file and run the php composer.phar install
command to install it.
{ "require": { "nticaric/twitter-streaming-api": "dev-master" } }
##Examples
POST statuses/filter
Returns public statuses that match one or more filter predicates
Usage:
use Nticaric\Twitter\TwitterStream; $stream = new TwitterStream(array( 'consumer_key' => 'my_consumer_key', 'consumer_secret' => 'my_consumer_secret', 'token' => 'my_token', 'token_secret' => 'my_token_secret' )); $res = $stream->getStatuses(['track' => 'car'], function($tweet) { //prints to the screen statuses as they come along print_r($tweet); });