Documentation

Controller

Controller is a main entry of a page, after routing.

Basic Example of Controller

Here's a basic example of controller that extends the base controller that's included in the framework.

    
    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()
        {
            // Pass a variable to the view
            return new ViewModel([
                'foobar' => 'Hello World!'
            ]);
        }
    }