The past few months I have been using Twitter a lot.  I’m trying to find and follow people that are heavily involved with PHP or at least providing knowledgeable Tweets about PHP.  I guess you could say that I am always open to new networking opportunities within the PHP community. :)

If you don’t know what Twitter is, well then you aren’t keeping up with your current events very well.  I’m not going to use this post explaining what it is more than a mini-blogging service.  If you don’t know, check their site out.  I provided a link above.

The problem I was having was actually judging whether or not it would be worth my time following their tweets. I mean, I follow someone that is really respected in a certain field, only to find out that they tweet about their new puppy they just got more than anything. So I made a PHP script that generates a “Twitter Tag Cloud.”  Using this, you can generate your own Twitter tag cloud to put on your personal site to display the top keywords that you have been tweeting about.

I also provide a REST service so that you don’t have to upload or play with any code yourself other than accessing the BrownPHP Twitter Tag Cloud service. I’ll show you more about that later. Or you can just use the textbox I have here to check out your own Twitter Cloud or a friends.

This is helpful to judge what the person tweets about the most.  The more the Twitter-er Tweets about a certain keyword, the larger it appears. Like if you would look at mine.  One of the large keywords is “informative.”  I also run a site called, Informative Post, and I tweet about it often, so it makes sense that this would be the largest keyword.

View Your Twitter Tag Cloud Now

Try it yourself! Type in a twitter username to see what that twitter-er tweets about more often:


Pretty cool, huh?  At the bottom of this, I provide a link where you can download the PHP files from.  I am also providing this as a REST service.

REST Twitter Tag Cloud Service

Parameters:

  • user (required)
    • Twitter Username
  • history (optional)
    • Number of past status updates to look for
    • Defaults to 100
    • Max is 200
  • size (optional)
    • Number of Keywords to return
    • Defaults to 50
    • Max is 75

Example REST call to get my (dlbrown06) Twitter tag cloud:
http://www.brownphp.com/rest/twittertagcloud.php?user=dlbrown06
Response:

<div id="twitterTagCloud"><a class="size2 tag" title="dlbrown06's Tweets Covering money" rel="nofollow" href="http://search.twitter.com/search?q=+money+from%3Adlbrown06" target="_blank">money</a>
<a class="size2 tag" title="dlbrown06's Tweets Covering taking" rel="nofollow" href="http://search.twitter.com/search?q=+taking+from%3Adlbrown06" target="_blank">taking</a>
<a class="size1 tag" title="dlbrown06's Tweets Covering networking" rel="nofollow" href="http://search.twitter.com/search?q=+networking+from%3Adlbrown06" target="_blank">networking</a>
<a class="size1 tag" title="dlbrown06's Tweets Covering social" rel="nofollow" href="http://search.twitter.com/search?q=+social+from%3Adlbrown06" target="_blank">social</a>
<a class="size2 tag" title="dlbrown06's Tweets Covering would" rel="nofollow" href="http://search.twitter.com/search?q=+would+from%3Adlbrown06" target="_blank">would</a>
<a class="size2 tag" title="dlbrown06's Tweets Covering children" rel="nofollow" href="http://search.twitter.com/search?q=+children+from%3Adlbrown06" target="_blank">children</a>
<a class="size2 tag" title="dlbrown06's Tweets Covering account" rel="nofollow" href="http://search.twitter.com/search?q=+account+from%3Adlbrown06" target="_blank">account</a>
<a class="size4 tag" title="dlbrown06's Tweets Covering working" rel="nofollow" href="http://search.twitter.com/search?q=+working+from%3Adlbrown06" target="_blank">working</a>
<a class="size3 tag" title="dlbrown06's Tweets Covering article" rel="nofollow" href="http://search.twitter.com/search?q=+article+from%3Adlbrown06" target="_blank">article</a>
<a class="size2 tag" title="dlbrown06's Tweets Covering start" rel="nofollow" href="http://search.twitter.com/search?q=+start+from%3Adlbrown06" target="_blank">start</a>
<a class="size2 tag" title="dlbrown06's Tweets Covering currently" rel="nofollow" href="http://search.twitter.com/search?q=+currently+from%3Adlbrown06" target="_blank">currently</a>
<a class="size1 tag" title="dlbrown06's Tweets Covering making" rel="nofollow" href="http://search.twitter.com/search?q=+making+from%3Adlbrown06" target="_blank">making</a>
<a class="size4 tag" title="dlbrown06's Tweets Covering online" rel="nofollow" href="http://search.twitter.com/search?q=+online+from%3Adlbrown06" target="_blank">online</a>
<a class="size2 tag" title="dlbrown06's Tweets Covering twitter" rel="nofollow" href="http://search.twitter.com/search?q=+twitter+from%3Adlbrown06" target="_blank">twitter</a>
<a class="size2 tag" title="dlbrown06's Tweets Covering morning" rel="nofollow" href="http://search.twitter.com/search?q=+morning+from%3Adlbrown06" target="_blank">morning</a>
<a class="size1 tag" title="dlbrown06's Tweets Covering sites" rel="nofollow" href="http://search.twitter.com/search?q=+sites+from%3Adlbrown06" target="_blank">sites</a>
<a class="size2 tag" title="dlbrown06's Tweets Covering right" rel="nofollow" href="http://search.twitter.com/search?q=+right+from%3Adlbrown06" target="_blank">right</a>
<a class="size5 tag" title="dlbrown06's Tweets Covering informative" rel="nofollow" href="http://search.twitter.com/search?q=+informative+from%3Adlbrown06" target="_blank">informative</a>
<a class="size2 tag" title="dlbrown06's Tweets Covering hosting" rel="nofollow" href="http://search.twitter.com/search?q=+hosting+from%3Adlbrown06" target="_blank">hosting</a>
<a class="size1 tag" title="dlbrown06's Tweets Covering until" rel="nofollow" href="http://search.twitter.com/search?q=+until+from%3Adlbrown06" target="_blank">until</a>
<a class="size2 tag" title="dlbrown06's Tweets Covering people" rel="nofollow" href="http://search.twitter.com/search?q=+people+from%3Adlbrown06" target="_blank">people</a>
<a class="size1 tag" title="dlbrown06's Tweets Covering looking" rel="nofollow" href="http://search.twitter.com/search?q=+looking+from%3Adlbrown06" target="_blank">looking</a>
<a class="size2 tag" title="dlbrown06's Tweets Covering starting" rel="nofollow" href="http://search.twitter.com/search?q=+starting+from%3Adlbrown06" target="_blank">starting</a>
<a class="size2 tag" title="dlbrown06's Tweets Covering really" rel="nofollow" href="http://search.twitter.com/search?q=+really+from%3Adlbrown06" target="_blank">really</a>
<a class="size3 tag" title="dlbrown06's Tweets Covering diablo" rel="nofollow" href="http://search.twitter.com/search?q=+diablo+from%3Adlbrown06" target="_blank">diablo</a></div>

Then you can use CSS to format the cloud however you like!

Download the Twitter Tag Cloud Source Code:

If you would like to use this source code yourself, you are free to do so.  All I ask is that you provide a link to this site, or somehow recognize the work that I put into it somehow.  I would love to see what kind of mashups that the PHP community could do with this source code. Enjoy!

Addendum (05/12/10):

This code has been added to the BrownPHP Code Repository if you would like to download it. You can go straight to the download by clicking the BrownPHP Twitter Class