PHP Wrapper for Klout API
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 |<