Rapid prototyping for PHP web development
ToroHandler.
For this example, there will only be one supported HTTP method, GET.
Create an instance of ToroApplication passing in an array of route => handler mappings in the constructor.
Finally, invoke the serve method.
Toro supports convenient handler methods for routing.
The base methods include all HTTP verbs, such as get, post, put, and delete.
Additionally, you can also append _xhr to any base, such as get_xhr, to match XHR requests.
You can also append _mobile to any base, such as get_mobile, to only match mobile browser requests.
Here is an example:
get_mobile and post_xhr - they will come in handy.
Toro has a simple callback system called ToroHook. There are four hooks:
before_request
after_request
before_handler
after_handler
Adding a hook pushes the provided function into an array. When a particular hook is fired, all of the functions are fired in the appropriate order. ToroHook was provided by Danillo César de O. Melo.
SomeHandler is executed, the output of the above request echoes will wrap the handler echoes.