title: RBAC in Yii2 with PhpManager
body: <p>How can I implement <code>RBAC</code> in <code>Yii 2.0</code> without any database. 
  I will have just 2 roles , i.e. <code>admin and author</code> .
  my RbacController is </p>
  
  <pre><code>&lt;?php
  namespace app\commands;
  
  use Yii;
  use yii\console\Controller;
  
  class RbacController extends Controller
  {
      public function actionInit()
      {
          $auth =  \Yii::$app-&gt;authManager;
  
          // add "createPost" permission
          $createPost = $auth-&gt;createPermission('createPost');
          $createPost-&gt;description = 'Create a post';
          $auth-&gt;add($createPost);
  
          // add "updatePost" permission
          $updatePost = $auth-&gt;createPermission('updatePost');
          $updatePost-&gt;description = 'Update post';
          $auth-&gt;add($updatePost);
  
          // add "author" role and give this role the "createPost" permission
          $author = $auth-&gt;createRole('author');
          $auth-&gt;add($author);
          $auth-&gt;addChild($author, $createPost);
  
          // add "admin" role and give this role the "updatePost" permission
          // as well as the permissions of the "author" role
          $admin = $auth-&gt;createRole('admin');
          $auth-&gt;add($admin);
          $auth-&gt;addChild($admin, $updatePost);
          $auth-&gt;addChild($admin, $author);
  
          // Assign roles to users. 1 and 2 are IDs returned by IdentityInterface::getId()
          // usually implemented in your User model.
          $auth-&gt;assign($author, 2);
          $auth-&gt;assign($admin, 1);
      }
  }
  </code></pre>
  
  <p>I am getting an error </p>
  
  <pre><code>  `PHP Fatal error: Call to a member function createPermission() 
  on a non-object in var/www/commands/RbacController.php on line 14
      PHP Fatal Error 'yii\base\ErrorException' with message 'Call to a member
   function createPermission() on a non-object' in /var/www/commands/RbacController.php:14 
  </code></pre>
  
  <p>while executing <code>yii rbac/init</code> . I am using basic template with PhpManager .  I have added <code>'authManager' =&gt; [ 'class' =&gt; 'yii\rbac\PhpManager', ],</code> in web.php .I am using basic template.</p>