Wallogit.com
2017 © Pedro Peláez
In order to gain a better understanding of how the MVC framework operates. I wanted to build one from scratch., (*1)
Within the web/index.php file, all routing is handled with $route->add(). You just need to specify the uri, controller, and action., (*2)
eg: $route->add("/", "index", "index"), (*3)
This ensures the home page is routed to the IndexController and returns the indexAction method., (*4)
All controllers should stored in the App\Controllers namespace (and directory), using the syntax {Uppercasename}Controller (eg. IndexController). However the file itself should be all lowercase (eg. indexcontroller.php), (*5)
The action within the controller uses the syntax {lowercasename}Action (eg. indexAction), (*6)
Set the view within an action using setView() method. (eg. $this->setView("/login"))). All view files are lowercase and stored in the app\views directory., (*7)