Skip to content

PHP Wrapper for Klout API

Dear Reader,

In a previous tweet about playing with Klout and Twitter I talked about a project I am working on that mines Klout for interesting people. (Well, interesting to me) The main body of code remains procedural because…well because it works and it’s not something I’m going to share so why bother cleaning it up. However parts of it may be useful to me in other projects. So I abstracted the Klout API into a class and have posted it for anyone who wants to use it.

Klout API Wrapper for PHP

Since this is my first GitHub repository, there is a pretty good chance I botched it. :) I’m hoping that if I did, one of you will be kind enough to point out how to do it correctly, and not that I just botched it.

The code itself is unremarkable. If you’ve ever written a wrapper for an API, they all work basically the same way. In this case, I ignored the concept of “Separation of Concern” in that I left the code that makes the call enclosed in the object. It’s on my todo list to split this off into it’s own class and possibly make a couple of different “transports”, mainly for example sake as they will all do basically the same thing, just use different PHP functions to do it. Then I would pass in a “Transport” into _execute() in what I believe is an implementation of the Visitor pattern. As I said, it would be largely educational for me because as is, the code works just fine. (and really, that’s the most important part.)

So, if you’ve ever wanted to play with Klout’s API (it’s VERY simple but I find the info it gives me very interesting.) I hope this little piece of code fluff makes it easier for you.

Until next time,
I <3 |<

5 thoughts on “PHP Wrapper for Klout API

  1. Well timed, Cal.

    Tomorrow, I start working for another company in the same space – I’ll have to see what I can do to put up some PHP/API code up to also fetch from the platform as I learn more about that myself – though right now, PI just returns a single metric. I’m sure that will change though as time goes on.


  2. Pingback: Tweets that mention PHP Wrapper for Klout API | Postcards From My Life --
  3. @alister!

    Thanks for stopping by.

    I played with PI last week, it looks pretty cool. I’d love an API to get to the topics. If you guys develop that, let me know, I want to play with it.


  4. Found this blog looking for a PI wrapper or widget of some sort. I think both Klout and Peerindex have the potential to be essential (qwerly is good too).

    Klout & Qwerly offer an embedded link with scores/details. Twitalyzer also has a mini-profile link that can be used in an iframe. PI offers nothing so you would have to visit frequently to check on your score and stats. LAME.

  5. Bob, in PeerIndex’s defence (full disclosure: I work at @peerindex) it’s a fast moving target around here, and both PI and Klout are still building our respective technologies. PI does have a basic API, and it’s already being used in a number of pieces of software – like, and

    I know that it’s far from complete, and one of the things we’ll be doing in our Copious Free Time is extending it – to add such things as topics for users, and more generally, which Cal has already commented on. It’s on the roadmap, and a lot more will get added to the information. For now, we are starting to add that onto the website. I would love to do a JS widget as well, but I think its better to let the underlying processes settle down a little first.

Comments are closed.