user4419336
user4419336

Reputation:

Different filename to class name yii

In yii 2.0 for the class is it possible to use like below where Home is the name and Common is the folder

And then on the filename just have Home.php

<?php

namespace app\controllers\common;

use Yii;
use yii\web\Controller;

class HomeCommonController extends Controller {

    public function actionIndex()
    {

        echo "From the Common Home";

    }

}

Then the url would be

http://localhost/yiitest/home

I am trying to see if possible to get same way opencart finds there controllers.

Upvotes: 0

Views: 205

Answers (1)

arogachev
arogachev

Reputation: 33548

No, it's not possible without overriding core classes. Yii2 do not perform search for folder names in controller class name. I do not recommend to go against framework standards and conventions. Each one has their own, better accept it and adapt to it.

Upvotes: 1

Related Questions