O Connor
O Connor

Reputation: 4392

Yii framework 2.0 Role based access control PhpManager

Working with Yii framework 2.0 I would like to work with Role Based Access Control using PhpManager. Follow the documentation I configure that as following.

return [
    'components' => [
        'authManager' => [
            'class' => 'yii\rbac\PhpManager',
        ],
    ],
];

In my controller class I just print that object out to see how it looks like.

print_r(\Yii::$app->authManager);

I've got the following error:

ReflectionException

Class yii\rbac\PhpManager does not exist

What might cause this error? I think because I miss the PhpManager component, but I am not sure. If I need to add this component, how can I do that? If it is not about missing this component. What might cause this error?

Upvotes: 0

Views: 329

Answers (1)

Ali MasudianPour
Ali MasudianPour

Reputation: 14459

Update your composer.json file like below:

"require": {
    "yiisoft/yii2": "*"
},

It'll be fixed.

Upvotes: 1

Related Questions