djikstra
be humble.
Back Home Next
Basic Request Routing
Humble is heavily dependent on .htaccess file functionality provided by Apache.

All URI requests that contain three segments (ex: /segment1/segment2/segment3) are routed to the /index.php Front Controller (FC) to be handled. This Front Controller will route the request to the appropriate module located in the /app/Code/package/ directory.

The following image explains the segments of the request URI:

Front Controller Routing URI

Example URI: /acme/customer/list

In the above example, this URI, because it has three segments, would be routed to the Front Controller (FC) where the FC will do a lookup on what module is registered using the 'acme' namespace, fetch that namespace's Package (remember, package=directory), and then look in the /app/Code/package/Acme/Controllers/ directory for the 'customer.xml' controller. Within that XML Controller it will branch to an action called 'list' and will perform the instructions contained there. Next the FC will forward on to the view contained in the /app/Code/package/Acme/Views/customer/templater/list (unless overridden,the name of the action from the controller (in this case 'list') is used as the name of the view) . The templater token is the name of the Server-Side renderer you are using, such as 'Twig', 'Smarty3', 'Mustache', etc...

Routing using allowed.json.

By default, the Humble framework is programmed to route all FC requests to the login page if the requestor is not logged in. By this logic, there really are only a few "public" facing pages (like index.html).

To register modules, controllers, or individual action/views as "public-facing", we use an override file that is in JSON format, and is located here:

    /app/allowed.json

This file contains the routes that are "open to anonymous/public" viewing. You can designate an entire module/namespace as public, a controller or controllers in a module as public, or list the specific individual actions/views that are public.

The example below demonstrates setting a specific URI, controller, and namespace to be public:



Loading Resources

For more advanced information on routing options, please read our From Monolith To MicroServices page.