Fork me on GitHub


Today we’ll cover one of the corner stones of modern application architecture – the controller. Its mission is to generate a Response based on the information provided by the client Request. Put in simplest terms: the controller contains the business logic of your application. Say, a client requests an URL example.com/is_leap_year/2012. Instead of writing everything inside of the file leap_year.php where the presentational markup and programming logic get mixed, we’ll move the leap year calculations into a very digestible container – the controller.