yii2 - Yii 2: The Fast, Secure and Professional PHP Framework Yii PHP Framework: Best for Web 2.0 Development yii is a high-performance component-based php framework best for web 2.0 development.

Yii2 disable Bootstrap Js, JQuery and CSS

Same as title, i don't want using bootstrap.css and bootstrap.js. I try using:

'assetManager' => [
    'bundles' => [
        'yii\bootstrap\BootstrapAsset' => [
            'css' => [],

It remove bootstrap.css but can't remove bootstrap.js. Somebody can help me?

Source: (StackOverflow)

ActiveRecord batch insert (yii2) [closed]

So, is it possible to insert multiple rows in one query with ActiveRecord, or it's better to use DAO for this?

Source: (StackOverflow)

Yii2: Why is the auth key in class User?

As the title clarifies why is the auth key introduced in Yii2? What're it's main usages and how it is useful in authentication?

Source: (StackOverflow)

Yii2 : ActiveQuery Example and what is the reason to generate ActiveQuery class separately in Gii?

Could you provide an example usage. Description will be highly appreciated. I can not find a good example for it.

ActiveQuery in Gii

Source: (StackOverflow)

How can I use a simple Dropdown list in the search box of GridView::widget, Yii2?

I am trying to make a dropdown list in the search box of a GridView::widget, Yii2 for searching related data. So, how can I create a simple dropdown list in the search box of GridView::widget, Yii2 framework?


Source: (StackOverflow)

Hide label for input field

I am trying to hide the label for a specific field in _form.php without success.

I have tried couple of variation like, but none is working:

<?= $form->field($model, 'sample_text')->textArea('label'=>false) ?>

and alternate code:

<?= $form->field($model, 'sample_text')->textArea('label'=>'') ?>

What is the right approach to hide a label?

Source: (StackOverflow)

yii2 hidden input value

In Yii2 I'm trying to construct hidden input

echo   $form->field($model, 'hidden1')->hiddenInput()->label(false);

But I also need it to have some value option, how can I do that ?

Source: (StackOverflow)

Yii2 + AngularJS in a single application - how?

I have experience with both Yii 2 and AngularJS, but separately. I have two questions:

Is it possible to use AngularJS in Yii 2's view? I am asking possible instead of feasible, because I think the problem may have arrived at routing.

Also, is it fair enough (for performance) to use Yii 2 and AngularJS together? (Both are MVC so for modular, manageable code.)

I searched for a long time, but I was unable to find any proper resource. What is the explanation!

Source: (StackOverflow)

How to pass param from controller to layout in YII2

I am facing a problem in YII2. Problem is i want to send a parameter from controller to layout (ie. main.php). But i am not able to get the param in main.php

I tried :

Controller Code :

$this->render('index',array('param' => $paramValue));

And this is how i was trying to get this in layout ie. main.php

  1. $this->param (as in yii 1)
  2. $param

But i am not able to get param value in layout. Can anyone tell me how to do this?

Many Thanks,


Source: (StackOverflow)

What's the difference between Yii 2 advanced application and basic?

What is the difference between advanced application and basic application in the Yii framework?

Does they have any differences regarding security?

Source: (StackOverflow)

Enable clean URL in Yii2

How can I enable clean urls in Yii2. I want to remove index.php and '?' from url parameters. Which section needs to be edited in Yii2 for that?

Source: (StackOverflow)

yii2 data provider default sorting

In yii this code works for default sorting:

$dataProvider = new CActiveDataProvider('article',array(
            'defaultOrder'=>'id DESC',

How default sorting can be set in yii2?

tried below code, but no result:

$dataProvider = new ActiveDataProvider([
        'query' => $query,
        'sort' => ['defaultOrder'=>'topic_order asc']

Source: (StackOverflow)

How to make a drop down list in yii2?

How to make a dropdown in yii2 using an activeform and a model? Since all the methods has changed in yii2,how it is done in the new one?

Source: (StackOverflow)

Disable CSRF validation for individual actions in Yii2

Is there a way to disable CSRF validation for some actions of the controller keeping it enabled for the other ones?

In my case I have several configurable Action classes, that are intended to be injected into controllers. I can't pass csrf validation token into the AJAX request because the thing I'm working with is external (made not by me) WYSIWYG plugin at the frontend. Yes, I can still disable csrf validation of the whole controller using these actions, but it may be insecure.

Source: (StackOverflow)

Securing non authenticated REST API

I have been reading about securing REST APIs and have read about oAuth and JWTs. Both are really great approaches, but from what I have understood, they both work after a user is authenticated or in other words "logged in". That is based on user credentials oAuth and JWTs are generated and once the oAuth token or JWT is obtained the user can perform all actions it is authorized for.

But my question is, what about the login and sign up apis? How does one secure them? If somebody reads my javascript files to see my ajax calls, they can easily find out the end points and the parameters passed, and they could hit it multiple times through some REST Client, more severely they could code a program that hits my sign up api say a thousand times, which would be create a thousand spam users, or they could even brute force the login api. So how does one secures them?

I am writing my API in yii2.

Source: (StackOverflow)