<?php namespace app\models; class User extends \dektrium\user\models\User implements \yii\web\IdentityInterface { public static function findByUsername($username) { return self::find()->andWhere(['username'=>$username])->one(); } }