Fork me on GitHub

Each module can add routes. To read more about how this works read the API documentation:

A route is the path behind the API URL. For example:


In this example http://localhost/api is the API URL and /system/check is the route.

A route leads to a controller class. Let's start with the simplest example.

Add the controller HelloController.php in the controller folder and enter:


namespace UX\Modules\Bands\Controller;

use GO\Core\Controller;

class HelloController extends Controller {

    public function actionName($name = "human") {
        $this->render(['data' => 'Hello ' . $name]);


The router can map HTTP requests to a controller action.

In this example we've implemented the GET request to return a JSON object that greets with hello. It has one GET query parameter that defaults to the string "human".

But we can't reach this controller method yet! We need to add a route to it in the module manager file. Add the route bands/hello like this in UX/Modules/Bands/Module.php:


namespace UX\Modules\Bands;

use GO\Core\Modules\Model\InstallableModule;
use UX\Modules\Bands\Controller\HelloController;

 * The bands module
 * A module for the tutorial.
 * @copyright (c) 2015, Intermesh BV
 * @author Merijn Schering <>
 * @license AGPLv3
class Module extends InstallableModule {

    public static function defineWebRoutes(\IFW\Web\Router $router) {

                        ->get('bands/hello', 'name');

Now do a GET request to the route "/bands/hello" (In our example the full URL is: http://localhost/api/bands/hello). It will output:

    "data": "Hello human" 

Make it say a name by going to "/bands/hello?name=Merijn"