dev-master
9999999-dev http://www.alex-sawallich.comZend Framework 2-Module which wraps J7mbo's PHP Twitter API.
The Requires
- php >=5.5
- j7mbo/twitter-api-php =1.0.5
api zend module zf twitter
Zend Framework 2-Module which wraps J7mbo's PHP Twitter API.
ZendTwitterApi is a very simple Zend-Framework 2-Module, which wraps J7mbo's PHP Twitter API.
ZendTwitterApi provides a service which can be retrieved from the ServiceManager
. 'OAuth'-Tokens, -secrets and so on, can be specified
in your config-file., (*1)
This means, that this module itself doesn't do anything. It's up to you to build modules using this API., (*2)
Installation can be done through composer., (*3)
Just add, (*4)
"alexsawallich/zend-twitter-api": "dev-master"
to your application's composer.json
and execute php composer.phar update
., (*5)
Then copy vendor/alexsawallich/zend-twitter-api/config/zend-twitter-api.global.php.dist
from to ./autoload/zend-twitter-api.global.php
. Open
the copied file and set the options, according to your twitter-application., (*6)
If you don't have a twitter-application yet, you can register one for free here: Twitter Application Management., (*7)
Anywhere in your code, where you have access to the ServiceLocator you can do the following:, (*8)
$twitterApi = $this->getServiceLocator()->get('ZendTwitterApi');
Check out the GitHub-page of J7mbo's PHP Twitter API to see what you can do with the API., (*9)
An example to get the 3 latest tweets for the user @alexsawallichde would be:, (*10)
$api = $this->getServiceLocator()->get('ZendTwitterApi'); $url = 'https://api.twitter.com/1.1/statuses/user_timeline.json'; $getfield = '?count=3&trim_user=1&exclude_replies=1&user_id=alexsawallichde'; $latestTweets = $api->setGetfield($getfield) ->buildOauth($url, 'GET') ->performRequest(); $json = json_decode($latestTweets);
A possible use-case would be to put something like the given example into a view-helper., (*11)
Zend Framework 2-Module which wraps J7mbo's PHP Twitter API.
api zend module zf twitter