In PHP, what are the different design patterns to implement OO controllers as opposed to procedural controllers?
- by Ryan
For example, it's very straightforward to have an index.php controller be a procedural script like so:
<?php
//include classes and functions
//get some data from the database
//and/or process a form submission
//render HTML using your template system
?>
Then I can just navigate to http://mysite.com/index.php and the above procedural script is essentially acting as a simple controller. Here the controller mechanism is a basic procedural script.
How then do you make controllers classes instead of procedural scripts? Must the controller class always be tied to the routing mechanism?