Skip to content
Switch branches/tags
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

WOW-Multi-Twitter 2.0 Class

Display Multiple Twitter Feeds on your Website


  • Display optional images.
  • Caches to Disk
  • Date Styling Options
  • Uses new customised OAuth wrapper from J7mbo to get access to the API
  • Can work with single Twitter feeds too
  • Object orientated so you can have multiple separate single feeds or multiple double feeds. Currently, a maximum of 2 feeds together at a time.


You should already have a consumer key, consumer secret, access token and access token secret for one or both of your twitter accounts.

If not visit Twitter Apps to create them.

PHP Server with CURL – The script has been tested using PHP 7 but should work for 5.6 and above.

A little knowledge of PHP and CSS are beneficial but not essential.


Unzip and copy the folder twitter and all it’s contents to your server.

On the page you want to display your twitter feed(s) load the class

  include_once 'twitter/includes/wow-multi-twitter.php';

Adding Keys and Tokens

Adding your Keys and Tokens to an array

//User 1
$consKey = '';//Add your Twitter Consumer Key here
$consSec = '';//Add your Twitter Consumer Secret here
$usrToken = '';//Add your Twitter User Token here
$usrSec ='';//Add your Twitter User Secret here

//User 2 If you only want one user, simply ommit any reference to user2
$consKey2 = '';//Add your Twitter Consumer Key here
$consSec2 = '';//Add your Twitter Consumer Secret here
$usrToken2 = '';//Add your Twitter User Token here
$usrSec2 ='';//Add your Twitter User Secret here

//Creates an array of the above keys for each user
$user1 = array($consKey,$consSec,$usrToken,$usrSec);
$user2 = array($consKey2,$consSec2,$usrToken2,$usrSec2);

Create a new instance of MultiTwitter

$twitter = new MultiTwitter();

Optional - Options

If no options are set then it will use the defaults detailed in the methods and properties section below. If you only set a few it will automatically use those from the defaults.

//Sets custom options
$options = array('maxTweets'=> 25,
 'caching_intervals' => 10,
 'display_images' =>true,


Set Users

Add our username and the key array we created earlier

//Sets the user. If you only want one user just use setUser1

Displaying the Tweets

  echo $twitter->displayTweets();

Methods and Properties


Setup authentication keys and tokens for the first user.

$username (String) Required

$keys (Array) Required


Setup authentication keys and tokens for the 2nd user, if a 2nd user is required.

$username (String) Required

$keys (Array) Required


Configure your own options

$options (Array) Optional


  $defaults = array('maxTweets'=> 20,
                  'include_retweets' => false,
                  'include_replies' => false,
                  'caching_intervals' => 60,
                  'display_images' => true

maxTweets- Default 20 (int) How many tweets you want to fetch from the Twitter Server per account.

style- default ‘time_since’ (string) Displays the date or time since format. The arguments are:

  • *‘eng_suff’ – Displays 21st February*
  • *‘ddmm’ – Displays 21 Feb*
  • *‘ddmmyy’ – Displays 21 Feb 2018*
  • *‘full_date’ – Displays Wed 21 Feb 2018*
  • *‘time_since’ – Displays the time since the tweet in hours, minutes etc.*
  • *‘month’ – Displays February 21, 2018*

include_retweets- default false(bool) Do you want to include any retweets?

include_replies- default false(bool) Do you want to include any replies?

caching_intervals- default 60(int) How often in minutes do you want to cache the JSON request?

display_images- default true(bool) Images are enabled by default but may not show on all tweets. You can optionally disable them.


Output(echo) your twitter feed(s) for the world to see.

Further options including CSS styling are available on my blog:


A PHP class to display your singe or multiple twitter feed(s)




No releases published


No packages published