title: How to allow guest access to some actions in Yii2 Controller?
body: <p>I'd like to know how to configure my controller to allow some actions to be executed as a guest and be able to show the view for that guest in Yii2.</p>
  
  <p>I've tried this rule in my behaviour</p>
  
  <pre><code>       'access' =&gt; [
             'class' =&gt; AccessControl::className(),                           
                  'rules' =&gt; [
                      [                   
                          'actions' =&gt; ['create','update'],       
                          'allow' =&gt; true,
                          'ips' =&gt; ['127.0.0.1'],                         
                      ]                       
                  ],                  
              ]
  </code></pre>
  
  <p>Edit:
  This is the config I tried :</p>
  
  <pre><code>    'access' =&gt; [
                  'class' =&gt; AccessControl::className(),                          
                  'rules' =&gt; [                                
                      [
                          'allow' =&gt; true,
                          'actions' =&gt; ['create', 'update'],
                          'roles' =&gt; ['?'],
                      ],
                  ],                  
              ]
  </code></pre>
  
  <p>Edit2: After checking out a new project(yii2-advanced) from scratch and trying to generate the controllers and models again the previous rules worked, I think it was some configuration from the previous project that were preventing me to access as a guest somehow.</p>