PHPackages                             macfly/yii2-remote-user-rbac - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. macfly/yii2-remote-user-rbac

AbandonedArchivedYii2-extension[Authentication &amp; Authorization](/categories/authentication)

macfly/yii2-remote-user-rbac
============================

Yii2 module to get user and rbac information from a remote api

0.2.1(8y ago)01.3kBSD-3-ClausePHP

Since Jan 31Pushed 8y ago1 watchersCompare

[ Source](https://github.com/marty-macfly/yii2-remote-user-rbac)[ Packagist](https://packagist.org/packages/macfly/yii2-remote-user-rbac)[ RSS](/packages/macfly-yii2-remote-user-rbac/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (10)Used By (0)

yii2-remote-user-rbac
=====================

[](#yii2-remote-user-rbac)

Yii2 User and Rbac provider from another Yii2 instance for sso or cenralized way to manage user and role.

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist "macfly/yii2-remote-user-rbac" "*"

```

or add

```
"macfly/yii2-remote-user-rbac": "*"

```

to the require section of your `composer.json` file.

Configure
---------

[](#configure)

> **NOTE:** Make sure that you don't have `user` component configuration in your config files.

Configure **config/web.php** as follows

```
  'components' => [
    ................
    'authClientCollection' => [
      'class'   => \yii\authclient\Collection::className(),
      'clients' => [
        'oauth2' => [
          'class'           => 'macfly\authclient\OAuth2',
          'authUrl'         => 'http://127.0.0.1:8888/oauth2/authorize',
          'tokenUrl'        => 'http://127.0.0.1:8888/oauth2/token',
          'apiBaseUrl'      => 'http://127.0.0.1:8888/oauth2',
          'clientId'        => 'testclient',
          'clientSecret'    => 'testpass',
          'requestOptions'  => [
            'sslVerifyPeer' => false,
            'sslVerifyPeerName' => false,
          ],
        ],
      ],
    ],
  ................
  'modules' => [
      ................
      'user'  => [
       'class'       => 'macfly\user\client\Module',
			 'cacheDuration' => 3600,
       'authclient'  => 'oauth2',
       'rememberFor' => 1209600, # Session life (default: 1209600)
       'identityUrl' => 'http://127.0.0.1:8888/user/api/identity', # (optional)
       'rbacUrl'     => 'http://127.0.0.1:8888/user/api/rbac',     # (optional)
#			 'userComponent' => '',
#      'modelMap'    => [],
#      'remoteModelMap' = [
#         'app\models\User' => 'User',
#       ],
      ],
      ................
  ],
```

Usage
-----

[](#usage)

Authentication with HTTP Bearer token
-------------------------------------

[](#authentication-with-http-bearer-token)

HttpBearerAuth is an action filter that supports the authentication method based on HTTP Bearer token.

You may use HttpBearerAuth by attaching it as a behavior to a controller or module, like the following:

```
public function behaviors()
{
    return [
        'authenticator' => [
            'class' => \macfly\user\client\filters\auth\HttpBearerAuth::className(),
        ],
    ];
}
```

Example of usage on a controller

```
curl --header 'Authorization: Bearer 0205ade34ff0b8dab4489059803add3fc9ba5c47' 'http://127.0.0.1:8888/api/publish'
```

Authentication with HTTP Basic Authentication
---------------------------------------------

[](#authentication-with-http-basic-authentication)

HttpBasicAuth is an action filter that supports the HTTP Basic authentication method.

You may use HttpBasicAuth by attaching it as a behavior to a controller or module, like the following:

```
public function behaviors()
{
    return [
        'authenticator' => [
            'class' => \macfly\user\client\filters\auth\HttpBasicAuth::className(),
        ],
    ];
}
```

Example of usage on a controller

```
curl 'http://0205ade34ff0b8dab4489059803add3fc9ba5c47:@127.0.0.1:8888/api/publish'
```

Authentication with Query Parameter Authentication
--------------------------------------------------

[](#authentication-with-query-parameter-authentication)

QueryParamAuth is an action filter that supports the authentication based on the access token passed through a query parameter.

You may use QueryParamAuth by attaching it as a behavior to a controller or module, like the following:

```
public function behaviors()
{
    return [
        'authenticator' => [
            'class' => \macfly\user\client\filters\auth\QueryParamAuth::className(),
        ],
    ];
}
```

Example of usage on a controller

```
curl 'http://127.0.0.1:8888/api/publish?access-token=0205ade34ff0b8dab4489059803add3fc9ba5c47'
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~31 days

Recently: every ~18 days

Total

9

Last Release

3134d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/74924cc29f67eef7ca7640876dd3462974466ea683f8d059c70a33b3087d7230?d=identicon)[Macfly](/maintainers/Macfly)

---

Top Contributors

[![marty-macfly](https://avatars.githubusercontent.com/u/12715929?v=4)](https://github.com/marty-macfly "marty-macfly (1 commits)")

---

Tags

userrbacyii2

### Embed Badge

![Health badge](/badges/macfly-yii2-remote-user-rbac/health.svg)

```
[![Health](https://phpackages.com/badges/macfly-yii2-remote-user-rbac/health.svg)](https://phpackages.com/packages/macfly-yii2-remote-user-rbac)
```

###  Alternatives

[2amigos/yii2-usuario

Highly customizable and extensible user management, authentication, and authorization Yii2 extension

298275.5k14](/packages/2amigos-yii2-usuario)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
