PHPackages                             layxis/yii3-rbac-web - 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. layxis/yii3-rbac-web

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

layxis/yii3-rbac-web
====================

Yii RBAC web module for Yii Framework 3 applications.

01PHP

Since Feb 3Pushed 3mo agoCompare

[ Source](https://github.com/layxisdev/yii3-rbac-web)[ Packagist](https://packagist.org/packages/layxis/yii3-rbac-web)[ RSS](/packages/layxis-yii3-rbac-web/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Yii3 RBAC Web Module (layxis/yii3-rbac-web)
===========================================

[](#yii3-rbac-web-module-layxisyii3-rbac-web)

A lightweight web module for managing RBAC (roles, permissions, assignments) in Yii Framework 3 applications.

Project layout (relevant):

- `src/Permission/` — Actions and views for Permission management
- `src/Role/` — Actions and views for Role management
- `src/Item/ItemForm.php` — Base form model (fields: `name`, `description`, `ruleName`, `type`)
- `config/route.php` — Route definitions
- `src/Rule/RuleCollectionProviderInterface.php` — Optional interface for providing rule lists

Requirements

- PHP 8.0+
- Composer

Note: Many `yiisoft/*` packages here follow development branches (e.g. `dev-master`) or specific major versions. For production use, pin stable versions and test compatibility.

Installation

From the project root run:

```
composer install
```

If you use a local `composer.phar` and need a specific PHP binary, set your PATH or run:

```
set PATH="D:\\Program Files\\php-8.4.16-nts-Win32-vs17-x64;"%PATH%
php ../composer.phar install
```

Usage

- Routes are defined in `config/route.php` with name prefixes `role/`, `permission/`, `assignment/`.
- Views live in `src/Permission/views/` and `src/Role/views/`.
- Form models (e.g. `src/Permission/PermissionForm.php`, `src/Role/RoleForm.php`) extend `ItemForm`, which sets the `type` automatically.

Common routes (see `config/route.php`):

- `permission/index` — list permissions
- `permission/create` — create permission
- `permission/update/{name}` — update permission
- `permission/delete/{name}` — delete permission
- `permission/view/{name}` — view permission

`role/*` routes are analogous.

Rule dropdown (`ruleName`)

The view templates use a select field for `ruleName`. To populate rule options, implement `RuleCollectionProviderInterface` (`src/Rule/RuleCollectionProviderInterface.php`) and inject the provider into Actions. Example flow:

- Action calls `$rules = $ruleProvider->getRules();`
- Pass `$rules` to the view; the view renders `Field::select($form, 'ruleName')` using provided options.

Example `RuleCollectionProvider` implementation is included at `src/Rule/RuleCollectionProvider.php` and a DI example is available in `config/services.php`.

Views &amp; CSRF

`config/params.php` enables CSRF injection for the view renderer (`CsrfViewInjection`), so views can use the injected `$csrf` token. The provided view templates use `Html::form()->csrf($csrf)` and include hidden `_csrf` inputs for POST forms.

Testing

Install dev dependencies and run tests:

```
composer test
# or
vendor/bin/phpunit
```

(Composer `scripts` includes a `test` entry.)

Developer notes

- Many `yiisoft/*` dependencies are set to development branches in `composer.json`. For production, prefer stable releases.
- If you run into dependency conflicts, Composer suggests using `--with-all-dependencies (-W)` or adjusting version constraints.

Contribution

PRs and issues are welcome. Please follow existing code style and include tests for new logic.

---

If you want, I can add an example Action injection snippet showing how to pass `$rules` to the view.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance54

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 50% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/48299ab33cfce44b921c9564d7b9c2387988baa9bf14b1f6523a3c4aba7a0769?d=identicon)[layxis](/maintainers/layxis)

---

Top Contributors

[![layxis](https://avatars.githubusercontent.com/u/251828118?v=4)](https://github.com/layxis "layxis (12 commits)")[![layxisdev](https://avatars.githubusercontent.com/u/251828118?v=4)](https://github.com/layxisdev "layxisdev (12 commits)")

### Embed Badge

![Health badge](/badges/layxis-yii3-rbac-web/health.svg)

```
[![Health](https://phpackages.com/badges/layxis-yii3-rbac-web/health.svg)](https://phpackages.com/packages/layxis-yii3-rbac-web)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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