The controller is used to pull together all the necessary data to build the page. The bootstrap determines which controller to use based on the first URL segment.

Phork comes with two core controllers (CoreControllerLite and CoreController), as well as a a site controller for each demo site in phork/sites/[sitetype]/controllers/SiteController.class.php and a script controller for each demo site in phork/sites/[sitetype]/controllers/ScriptController.class.php.

Additionally the standard site comes with a ConcatController at phork/sites/standard/controllers/ConcatController.class.php for outputting minified and concatenated CSS and Javascript files in conjunction with the ConcatHelper utility.

All the controllers must implement the Controller interface found at phork/php/core/interfaces/Controller.interface.php.

The main difference between the core controllers is that CoreController is used to build a page that consists of several optionally cacheable nodes (eg. header, footer, errors) whereas CoreControllerLite displays a full page.

After the controller has been instantiated, the run() method is called which sets up (or delegates to other methods to set up) all the necessary data for all pages built by the controller. Then run() calls display() which builds and displays the page.

The controllers must also contain a public error() method to handle any fatal errors.

All page output is handled by the Display class.