Simple wrapper for alct/noapi.
\cmal\Twitter
is fully compatible with the original noapi methods. However, it additionally supports the caching of requests, and parsing from an array of params and not just a query string. The cache TTL (in seconds) is passed as a parameter to the class constructor:
$tweets = (new Twitter(60))->fromQuery($query);
The fromQuery
method is the original way of interacting with noapi, defined by the queryToMeta method. This is the method called when you do:
$data = $noapi->twitter($query);
The fromMeta
method is when you know precisely what kind of query you'd like to operate, bypassing queryToMeta. For example:
$hashtag = 'anarchism';
$args = [
'type' => 'hashtag',
'query' => $hashtag,
'url' => 'https://twitter.com/hashtag/' . $hashtag . '?f=tweets'
];
$tweets = (new Twitter(60))->fromMeta($args);
Copyleft GPLv3