response->format = \yii\web\Response::FORMAT_JSON; parent::init(); } public function beforeAction($action) { //todo /*if (Yii::$app->user->isGuest) { }*/ return true; } }