PHPackages                             macfly/yii2-rbac-cli - 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. [CLI &amp; Console](/categories/cli)
4. /
5. macfly/yii2-rbac-cli

ActiveYii2-extension[CLI &amp; Console](/categories/cli)

macfly/yii2-rbac-cli
====================

Yii2 module, provide a cli to load initial permission and roles in rbac from a yaml file

0.1.8(3y ago)126.0k↓100%2BSD-3-ClausePHP

Since Mar 17Pushed 3y ago1 watchersCompare

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

READMEChangelog (5)Dependencies (1)Versions (13)Used By (0)

yii2-rbac-cli
=============

[](#yii2-rbac-cli)

Create role and permission from the command line based on the content of a YAML or JSON file.

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-rbac-cli" "*"
```

or add

```
"macfly/yii2-rbac-cli": "*"
```

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

Configure
---------

[](#configure)

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

```
  'modules' => [
     ................
    'rbac'  => [
      'class'       => 'macfly\rbac\Module',
    ],
    ................
  ],
```

Usage
-----

[](#usage)

Import static role and permission list
======================================

[](#import-static-role-and-permission-list)

Create a yaml file with le list of static role and permission you want to create

```
# Permission section
permissions:
  list:
    desc: List user
  create:
    desc: Create user
  update:
    desc: Edit user
  profile:
    desc: Edit user profile
  delete:
    desc: Remove user

# Role section
roles:
  view:
    desc: View users
    children:
    - list
    - info
  admin:
    desc: Administration
    children:
    - view

# Assign permission and roles to a specific userid
assign:
  1:
  - admin
  - oauth.admin
  2:
  - user.info
```

After run the @rbac/yaml@ with the path to your yaml file

```
php yii rbac/load/yaml /tmp/role.yml
```

Add role or permission to a specific user
=========================================

[](#add-role-or-permission-to-a-specific-user)

You can add some role and permission from the cli to a specific user id.

```
php yii rbac/load/add userid permissionOrRoleName
```

For example to add role 'view' to user with id '1' :

```
php yii rbac/load/add 1 view
```

###  Health Score

32

—

LowBetter than 71% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% 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 ~186 days

Recently: every ~366 days

Total

12

Last Release

1291d 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 (2 commits)")[![phusy](https://avatars.githubusercontent.com/u/15340435?v=4)](https://github.com/phusy "phusy (1 commits)")

---

Tags

cliyamlymlrbacyii2load

### Embed Badge

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

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

###  Alternatives

[j13k/yaml-lint

A compact command line utility for checking YAML file syntax

161.1M19](/packages/j13k-yaml-lint)[samdark/yii2-webshell

A web shell that allows to run yii console commands and create your own commands.

22981.5k](/packages/samdark-yii2-webshell)[trntv/yii2-tactician

A simple, flexible command bus. This package provide it's integration with Yii2

1458.3k](/packages/trntv-yii2-tactician)[access9/dbtabledump

The database table dumper

1014.0k](/packages/access9-dbtabledump)

PHPackages © 2026

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