Last night my friend wanted help with custom PHP cms which he was built for his client.The code was really a mess.You would not know where the code actually began and there was clearly no separation between the model and the views.

I didn’t want to spend considerable amount of time in understanding the code.I started debugging the code using the die function.Yeah ‘die php die’.

die() is a pretty awesome function it is similar to the raising an exception but instead of causing a crash it  just stops code execution for the consecutive lines.You can also pass arguments to the die function.

I was really not sure how the user session was stored/created.So i used the die function by passing the var_dump($_SESSION) as the argument, this returns the all the session information.

The php array was returned with a bunch of keys which didn’t make sense at all.

The good part about the whole experience was I spent less than 2 minutes in the ugly PHP land.

Toro is simple PHP Router that has beautiful & minimalistic syntax.Its just 125 lines of php.

Building a rest client is as pretty simple.All one has to do is require the library and set up the routes.You may ask me whats the difference between Toro and other routing framework.To that I will say there are many.First the code is so simple and clean(a daunting when using PHP).The API it provides are simple and straight forward as well with minimal setup requirements.It also includes pre & post hooks.

To setup a basic route one has to do the following