Create a Magento Controller

YouTube player

How to Create a Magento Controller

As we discuss in the previous lesson the Controller consist of two parts controllerName and actionName

We will create new controller under Kickstart folder

Controller/Index/Index.php

and we will use predefined template to create our controller

For now, we will just use the die() function to output some text to make sure things are working.

<?php

declare(strict_types=1);

namespace Itcforu\Kickstart\Controller\Index;

use Magento\Framework\App\Action\HttpGetActionInterface;

class Index implements HttpGetActionInterface
{
    public function execute()
    {
        die('kickstart!');
    }
}