Documentation

Route

The JiNexus Framework Route lets you map URL patterns towards classes and methods for each module.

Basic Example of Route

Here's a basic example about our routing system.

    
    namespace namespace Application;

    use Application\Controller\IndexController;

    return [
        'routes' => [
            'application.home' => [ // Route name
                'route' => '/', // Route URI
                'controller' => IndexController::class, // Controller to dispatch
                'action' => 'index' // Method to dispatch
            ],
        ]
    ];
    
                

Routes are registered in the module/{Module}/config/module.config.php.

Route Redirect

You can simply redirect to another route using the command below. You only have to provide the route name of the route that you want to be redirected.

    
    namespace namespace Application\Controller;

    use JiNexus\Mvc\Controller\AbstractController;
    use JiNexus\Mvc\Model\ViewModel;

    /**
     * Class IndexController
     * @package Application\Controller
     */
    class IndexController extends AbstractController
    {
        /**
         * @return ViewModel
         */
        public function indexAction()
        {
            $this->redirect->toRoute('application.about.author');
        }
    }
    
                

Or if you want to redirect permanently, you can turn the second argument to true.

    
            $this->redirect->toRoute('application.about.author', true);
    
                

As you can see the route system is very straight forward and simple. Each route has its own route name, a corresponding URI, and a controller and method to dispatch.