unniks/twitter-powertracker is a Laravel package for a laravel package for twitter powertrack.
It currently has 0 GitHub stars and 55 downloads on Packagist (latest version 1.0.1).
Install it with composer require unniks/twitter-powertracker.
Discover more Laravel packages by unniks
or browse all Laravel packages to compare alternatives.
Last updated
Twitter Power Tracker is the package for connecting and streaming data with twitter's enterprise streaming plans.
$ composer require unniks/twitter-powertracker
unniks\TwitterPowertracker\PowerTrackerServiceProvider::class,
'TwitterPowertracker' => unniks\TwitterPowertracker\PowerTrackFacade::class,
$ php artisan vendor:publish --provider="unniks\TwitterPowertracker\PowerTrackerServiceProvider"
We need GNIP account before using with this feature. If you have GNIP username and password, add following variables in your .env file
TWITTER_GNIP_USERNAME=[email protected] <br>
TWITTER_GNIP_PASSWORD=xxxxx <br>
TWITTER_GNIP_URL=https://gnip-stream.twitter.com/stream/powertrack/accounts/{username}/publishers/twitter/{variable}.json <br>
TWITTER_GNIP_REPLAY_URL=https://gnip-stream.gnip.com/replay/powertrack/accounts/{username}/publishers/twitter/{variabale}.json <br>
TWITTER_GNIP_STREAMING_30_DAYS_URL=https://gnip-api.twitter.com/search/30day/accounts/{username}/{variabale}.json <br>
TWITTER_GNIP_RULES_URL=https://gnip-api.twitter.com/rules/powertrack/accounts/{username}/publishers/twitter/{variabale}.json
use TwitterPowertracker;
_
$json = {"rules" :[{"value" : "from:foo","tag" : "some_foo_tag"},{"value" : "foo:keyword"}]} ;
TwitterPowertracker::ruleCreationByJson($json);
_
$rules =['from:rahul','@shami'];
TwitterPowertracker::ruleCreationByArray($rules);
_
$rules = ['from:rahul','@shami'];
$tags = ['rahul_tag','sham_tag'];
TwitterPowertracker::ruleCreationByArray($rules,$tags);
note: array index of $tags should have matched to array index of $rules
_
TwitterPowertracker::ruleDeletionByJson($json);
_
TwitterPowertracker::ruleDeletionByJson($json);
TwitterPowertracker::ruleDeletionByArray($rules,$tags);
What is rules? Please go through this documentation: https://developer.twitter.com/en/docs/tweets/filter-realtime/overview/powertrack-api
use TwitterPowertracker;
TwitterPowertracker::powerStream();
By calling powerStream() data will be continuously streamed to the model app/TwitterPowerTrackerStream.php
public static function getPowerTrack($data)
{
//do some stuff with incoming $data
}
//return "exit" in the function "app/TwitterPowerTrackerStream.php"
public static function getPowerTrack($data)
{
//some code
if(//some condition)
{
return "exit";
}
}
$results = TwitterPowertracker::thirtyDaysGet($rule);
$results = TwitterPowertracker::thirtyDaysGet($rule,$maxResults);
$results = TwitterPowertracker::thirtyDaysGet($rule,$maxResults,$startDate,$endDate);
$results = TwitterPowertracker::thirtyDaysGet($rule,$maxResults,$startDate,$endDate,$next);
(use https://support.gnip.com/apis/search_api2.0/api_reference.html for reference)
The unniks/twitter-powertracker is open-sourced software licensed under the [MIT license]