2017 © Pedro Peláez
 

library zend-twitter-api

Zend Framework 2-Module which wraps J7mbo's PHP Twitter API.

image

alexsawallich/zend-twitter-api

Zend Framework 2-Module which wraps J7mbo's PHP Twitter API.

  • Wednesday, November 18, 2015
  • by alexsawallich
  • Repository
  • 1 Watchers
  • 0 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Introduction

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

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)

Usage

Anywhere in your code, where you have access to the ServiceLocator you can do the following:, (*8)

$twitterApi = $this->getServiceLocator()->get('ZendTwitterApi');

What to do now?

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)

The Versions

18/11 2015

dev-master

9999999-dev http://www.alex-sawallich.com

Zend Framework 2-Module which wraps J7mbo's PHP Twitter API.

  Sources   Download

The Requires

 

api zend module zf twitter