PHP Fatal Error - Class 'app\controllers\Users' not found in yii2



While developing a website or web application with Yii2, you may get an error called “PHP Fatal Error – Class ‘app\controllers\Users’ not found in Yii2″.

In Yii1.0, you do not need to define models(those are being used in current controller) in top of controller. But Yii framework added this functionality in new release of framework called Yii2.

So if you are going to use any Model in your controller, you need to define first at top of the controller, like beneath.


//define used model here
use app\models\Users;

//than start controller class
class UsersController extends Controller

This is not a big issue, what you have to do is, just define model in controller which you may forgot.

Hope this will help. If still not than add comment below.

I would like to help with this issue. :)