With the deprecation of Twitter’s API 1 and the official adoption of version 1.1, adding customized tweets to a website has gone from simple to arduous. This PHP timeline starter framework generates a fully customizable, fully CSS-styleable timeline. It should help creators overcome the barriers of OAuth, JSON parsing, and formatting functions so they can get back to designing.

Download File Download

README on GitHub | Demo

It used to be commonplace to see clever, creative treatments of tweets displayed on websites, particularly portfolios. This trend has more or less collapsed recently, but not because Twitter is any less of a behemoth in social networking. With the deprecation of version 1 of their API, Twitter effectively broke every implementation of good old blogger.js across the web. The landscape of embedding tweets in websites is altered dramatically.

Version 1.1 considers any custom implementation of a tweet or timeline an application. That means no more tapping into a small JavaScript file to quickly and easily output some tweet text HTML and a timestamp… at least, not if custom styling is desired. Twitter still offers several options for embedding timelines and statuses in the form of widgets / Embedded Tweets. However, if styling is desired, beware. Twitter’s Embedded Tweets API documentation even warns:

Assume the embed HTML format will change. The HTML markup for the embed may change over time, so don’t assume classnames or the DOM layout will stay the same. If you need to style the embedded HTML, wrap it in a parent element and style the parent.”

And then there’s authentication. Unless one of Twitter’s prefab widgets is being used, anyone desiring to use the API to GET-request tweets will need to have OAuth set up on their website.

Initially, this was enough to put many people off. Nicely styled Twitter feeds were replaced by boring, default widgets or disappeared off websites entirely (including this blog!).

All of that being said, API 1.1 is powerful and cool, even if the goal isn’t to write the next TweetDeck or Twitterific.

The main issue is the barrier to entry.

There are several hurdles that need to be overcome in order to take advantage of the REST API v1.1 and put custom Twitter timelines on websites.

The first hurdle is the need for a server-side authentication library. The second hurdle is the need to parse a lot of JSON and write all the formatting of timestamps and plaintext tweets manually. The third is writing the logic required to create a timeline that functions in a desirable, Twitter-like, interactive way. Finally, the fourth is the fact that Twitter has far more stringent rules about displaying their content if the API is being used.

Clearing the hurdles is gratifying but a decent amount of work (and simultaneously feeling like the work had been done previously). The curve can be particularly steep for those who don’t dabble in the server-side. Previously, it was entirely possible to put timelines on a website using only the client-side. Not even a working knowledge of JavaScript was required; one had only to call blogger.js from Twitter and take care of the rest with HTML and CSS.

Lowering the barrier to entry:

I put together a starter kit that takes care of all four hurdles, or at least lowers them to a manageable height. Its function is to place a fully customizable, fully styleable Twitter user timeline on a website (providing PHP is available).

Available on GitHub.

(Or direct-download the master branch zip file at the top of this post.)

See the GitHub twitter-timeline-php repository to view the README, submit issues, or fork (I’d love to see this translated into other server-side languages).