News Archive
PhpRiot Newsletter
Your Email Address:

More information

Calculate the impact of your posts

Note: This article was originally published at Planet PHP on 21 March 2011.
Planet PHP

Today on HN there was a thread on how to get the Facebook share counts for a URL. Turns out that with Facebook, just like with most social web services this is quite easy. And actually I've been doing this since 2007 to calculate news item relevance on Maemo News.

Of course the social web landscape has changed quite a bit since the 2007 launch of our "social news" service, and many of the original relevancy sources have fallen into misuse. So now, in preparation of the new Planet MeeGo aggregator, I decided to clean up the calculations into a generic PHP library. Usage is simple:

require('calculate.php'); $url = ''; // Get the raw count for only one source echo com_meego_planet_calculate::hackernews($url); // 145 echo com_meego_planet_calculate::facebook($url); // 1 // Get weighted total score for all sources echo com_meego_planet_calculate::all($url); // 130.8

Grab the source from GitHub. I'd be happy to accept pull requests adjusting the weight scheme or adding new social sources.

And if you want to run a "Planet" in similar mode to what we have on Maemo, providing a quick front-page view of only the most relevant posts, and a separate page of all posts, then the repository has a full Midgard MVC component for doing that.