Kohana Simple REST Server

Published on:
Tags: Personal

I’ve been using something like this for a little while now, but initially held back on writing anything about it as I wanted to do something a little better using the Router3 module and/or KO3, however there has been some noise recently about REST, so I thought I would share this implementation as a possible starting point.

REST service implementations seem to be growing in popularity at the moment, I’m sure the likes of de.licio.us, twitter, flickr et al have done a lot to raise it’s profile but essentially its a concept that still suffers from a lack of general understanding.

Read on →

Unit Testing Basic Html Output - assertTag

Published on:
Tags: PHP, Personal

About 18 months ago I started to dabble with unit testing within PHP, I first looked at simpletest before ultimately settling with PHPUnit. I was a little cautious at first, primarily concerned with the amount of time writing the tests were taking and maintenance of said tests, but soon realised their full potential.

It’s safe to say now I couldn’t really imagine developing anything of significant size without them, and I just simply havn’t yet come across any argument which can go anyway to persuading me otherwise. One exceptionally useful tool I make use of is code coverage analysis using xdebug with PHPUnit. This is an amazing tool which will analyze my tests telling me exactly what code (at class, function or line level) is covered by which tests, and how many times. More important than telling me which code IS covered it will tell me what code IS NOT covered. Cyclomatic complexity tells us that the number of unique linearly independent paths through a function relates directly to that functions complexity, to¬†accurately¬†test this function we need to cover all possible execution paths. Code coverage analysis flags this up for us in a clear, readable fashion – brilliant.

Read on →

Git Resources

Published on:
Tags: Personal

Old Git Wit I’ve been using svn for a good few years now, and until a few months ago resisted the change of moving to another versioning software. However as the general buz of the internet turned more and more to distributed version control systems I started to read up a little on them.

I saw bazaar and git as the two potential front runners but after some of the Kohana devs made some noise about Git (and hinted Kohana may ultimately move towards Git), I decided to pick up and Git as my potential weapon of choice.

Read on →

Kohana Twitter Library

Published on:
Tags: Kohana, PHP

I previously posted the Curl library that came about as a result of needing this Twitter integration for something I was doing, so I thought it would be rude not to post up the twitter library as well!

I gues you could say twitter has become fairly popular (follow me at ninja_p) So if this library helps anyone out then feel free to take advantage of it. As usual any comments, critisism and/or requests are greatly received!

Read on →

Kohana Curl Library

Published on:
Tags: Kohana, PHP

So Curl is awesome! But due to my goldfish-esc memory working with it is always a lesson in searching the docs. The great thing with working with a framework is that such tasks can easily be adapted to your own way of working. The great(est?) thing about Kohana is that it is just so damn adaptable, it provides you with a shed load of functionality right out the box, but it’s true power (to me) is that it is easy to adapt to my way of thinking and my way of developing. Add to that the fact that adding extra stuff is laughably easy (if it hasn’t been done allready) and you have a mighty powerful weapon.

I needed a bit of twitter integration for something I was doing, which required some use of Curl. I could of bundled this in with the Twitter library but like a good modular, OO programmer I seperated the logic out into its own library: the Kohana Curl library was born.

OK, after all that great white hype the lib is VERY basic, and as stated before works around my way of thinking so may not suit everybody, but if you have any requests / suggestions then I’d love to hear them!

Usage Examples
[code lang=“php”] [/code]

[code lang=“php”] ‘beer’, ‘eat’ => ‘meat’)); ?> [/code]

/Matt