O'Reilly logo

Learning FuelPHP for Effective PHP Development by Ross Tweedie

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Routing

As with other frameworks, FuelPHP has fairly extensive routing capabilities. In this section, we will run through the basics.

Firstly, there are a couple of reserved routes; they are: _root_ and _404_. The _root_ key is used when there is no URL specified; for example, the home page or root page. The second (_404_) is for when the requested content controller or view can't be found.

The routes exist in the config folder of the application in a file called routes.php. Let's load the routes.php file from the following path comprising the following code:

[rootOfProject]/fuel/app/config/routes.php

<?php
return array(
    '_root_'  => 'welcome/index',  // The default route
    '_404_'   => 'welcome/404',    // The main 404 route
);

As you can see from the routes ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required