Hello, in Yii 1 there was a base controller class in protected/components/Controller.php
Since all controllers (by default) extended from this class, this was useful to me, fos example, having a default layout for all controllers:
Or do user verification overriding this function:
protected function beforeAction($action)
How can we achieve this in Yii 2?
Nearly like in Yii 1.
Create a “BaseController” your own.
Create for example:
class MyBaseController extends Controller
// base controller code
And let all controllers inherit from that controller with:
class MyController extends MyBaseController
Thank you very much MetaCrawler for pointing me the right direction. That makes sense