Integrating Yii2 into Joomla and using Joomla's "user" table

Hi there,

Ultimately, I’m trying to integrate Yii2 into Joomla so that I can use Joomla’s user management capabilities in conjunction with Yii2’s RBAC capabilities. For example, I want to allow a user to signup using Joomla’s registration process, but I want to define the roles and authentication rules using Yii2’s RBAC.

The problem is that Yii2 does not seem to be able to use Joomla’s “user” table to lookup the user_id value for the currently logged-in user (which is necessary if I want to check permissions for logged-in users against Yii2’s RBAC auth_assignment table).

NOTE: I am using the "basic" template alongside Joomla 3

Success criteria:

  • “Yii::$app->user->getId();” should return the currently logged-in user’s user_id from Joomla’s “user” table

  • Yii2’s RBAC functions should also work and use Joomla’s “user” table when looking up user_id –

if (Yii::$app->user->can('some-auth-item'))


            return $this->render('some-page');


Here is what I’ve attempted unsuccessfully thus far:

  1. Added Yii2 to Joomla into index.php (this gets loaded without an issue)




$yiiConfig = require('/../../../basic/config/web.php');

new yii\web\Application($yiiConfig); // Do NOT call run() here

  1. Change default User table in models/User.php



class User extends ActiveRecord implements IdentityInterface


      public static function tableName()


         return 'fm3lk_user';


  1. Tested using the following code in index.php and logged-in to Joomla front-end using Admin account, but does not return a value


        $zzz = Yii::$app->user->getId();

        echo $zzz;