MarkupTwitterFeed by Ryan Cramer

Module that generates an HTML list for a Twitter feed and caches it. Use this to show a Twitter feed on your ProcessWire-powered website.


Module that generates an HTML list for a Twitter feed and caches it.

Use this to show a Twitter feed on your ProcessWire-powered website.

This module uses the tmhOAuth library by @themattharris. This library is included with the MarkupTwitterFeed module files.


  • ProcessWire 3.0 or newer
  • PHP 5.3 or newer (7.x+ recommended)
  • PHP must have CURL and hash_hmac support (already present in most hosting environments)

To Install

  • Place the module files in /site/modules/MarkupTwitterFeed/
  • In ProcessWire admin, go to Modules > Check for new modules and click install for Twitter Feed Markup.
  • Note the Twitter API settings on the settings screen.
    • To obtain these, create a new Twitter application at:
    • Once created, copy and paste the settings to the module configuration.

To Upgrade

Before upgrading, please note that this module now requires PHP 5.3 or newer. If you are running PHP 5.2, this module likely will not work.

If you already have the old MarkupTwitterFeed module installed, you do not need to uninstall it unless it is installed in some location other than /site/modules/MarkupTwitterFeed/MarkupTwitterFeed.module. If it is installed in that location, then simply overwrite the old MarkupTwitterFeed files with the new ones. If it is not already installed in that location, then uninstall the module first from the modules admin screen, and then remove the file.

Proceed with the installation instructions under the To Install section above.

Note that the render() method no longer requires a URL as the first argument. Instead, you may specify no arguments or specify the $options array as the first argument. However, you do not have to update existing code if you do not want to, as this module will detect and ignore old syntax.


Basic example:

$t = $modules->get('MarkupTwitterFeed'); 
echo $t->render();

Specifying options example:

$options = array(
  'limit' => 3,
  'cacheSeconds' => 600, // 10 minutes
  'showDate' => 'before'
$t = $modules->get('MarkupTwitterFeed');
echo $t->render($options);

If preferred, you can specify options individually before calling render:

$t = $modules->get('MarkupTwitterFeed'); 
$t->limit = 3;
$t->cacheSeconds = 600;
$t->showDate = 'before';
echo $t->render();

Or you can iterate the feed rather to generate your own markup... Note that when doing this, all of the $options that modify output are no longer applicable, as you will be given the data exactly as it is from Twitter. This will likely change in the next version. But for now, if you take this route, you should avoid setting any options that would affect the output, so that you will not be affected by changes in the next version.

$t = $modules->get('MarkupTwitterFeed');
$t->limit = 3;
foreach($t as $item) {
  echo "<p>$item[text]<br /><span class='date'>$item[created_at]</span></p>";

All available options

Default values are shown below.

$t->limit = 3;                  // max items to show
$t->cacheSeconds = 3600;        // seconds to cache the feed (3600 = 1 hour)*
$t->dateFormat = 'F j g:i a';   // PHP date() or strftime() format for date field: December 4, 2013 1:17 pm
$t->dateFormat = 'relative';	// Displays relative time, i.e. "10 minutes ago", etc.
$t->linkUrls = true;            // should URLs be linked?
$t->showHashTags = true;        // show hash tags in the tweets?
$t->showAtTags = true;          // show @user tags in the tweets?
$t->showDate = 'after';         // show date/time: 'before', 'after', or blank to disable.
$t->showReplies = false;        // show Twitter @replies in timeline?
$t->showRetweets = false;       // show Twitter retweets in timeline?
$t->timeline = 'user_timeline'; // what timeline to show: mentions_timeline, user_timeline, home_timeline or retweets_of_me
$t->screenName = '';            // screen name to return results for (default=blank, Twitter default)
$t->consumerKey = '';           // Twitter API consumer key*
$t->consumerSecret = '';        // Twitter API consumer secret*
$t->userToken = '';             // Twitter API access/user token*
$t->userSecret = '';            // Twitter API access/user secret*

// generated markup options:
$t->listOpen = "<ul class='MarkupTwitterFeed'>";
$t->listClose = "</ul>";
$t->listItemOpen = "<li>";
$t->listItemClose = "</li>";
$t->listItemDateOpen = "<span class='date'>";
$t->listItemDateClose = "</span>";
$t->listItemLinkOpen = "<a href='{href}'>";
$t->listItemLinkClose = "</a>";

*Note that the default value of these options is configured from the MarkupTwitterFeed module settings screen.

Install and use modules at your own risk. Always have a site and database backup before installing new modules.

Twitter updates

  • ProcessWire 3.0.185 (dev) core updates, plus new Session Allow module— More
    17 September 2021
  • Three new ProcessWire Textformatter modules: Find/Replace, Markdown in Markup, and Emoji— More
    3 September 2021
  • This week we have a new master version released after a year in the making. With nearly 40 pull requests, hundreds of new additions and more than 100 issue reports resolved, this new version has a ton of great new stuff— More
    27 August 2021

Latest news

  • ProcessWire Weekly #384
    In the 384th issue of ProcessWire Weekly we'll cover the latest core updates, introduce a new module called Session Allow, and highlight a new site of the week. Read on! / 18 September 2021
  • ProcessWire 3.0.184 new master/main version
    This week we have a new master/main version released after a full year in the making. As you might imagine, this new version has a ton of great new stuff and we’ll try to cover much of it here.
    Blog / 27 August 2021
  • Subscribe to weekly ProcessWire news

“I am currently managing a ProcessWire site with 2 million+ pages. It’s admirably fast, and much, much faster than any other CMS we tested.” —Nickie, Web developer