PHPackages                             erickskrauch/yii2-rbac-migration - 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. [Database &amp; ORM](/categories/database)
4. /
5. erickskrauch/yii2-rbac-migration

ActiveYii2-extension[Database &amp; ORM](/categories/database)

erickskrauch/yii2-rbac-migration
================================

Trait for Yii2, that adds to the migrations methods for managing RBAC

0.1.1(5y ago)537.1k↓38.5%MITPHP

Since Jan 21Pushed 5y ago2 watchersCompare

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

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

Yii2 RBAC Migration
===================

[](#yii2-rbac-migration)

[![Latest Version on Packagist](https://camo.githubusercontent.com/06765953ade751e8e339c4f8112b9a8ccf0a6bdaed12a4e97062cedcb7bb6b40/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f657269636b736b72617563682f796969322d726261632d6d6967726174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/erickskrauch/yii2-rbac-migration)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/92df7012a7f406f179e11ef5b7f50db964c08ffdf0724d16ea1a283e06f99894/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f657269636b736b72617563682f796969322d726261632d6d6967726174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/erickskrauch/yii2-rbac-migration)

Simple and useful extension for migrations in Yii2. It allows you to perform operations on the Roles and Permission directly within the database migrations. This can be useful if you assign the Roles and Permissions for users in the application and not during the generation of RBAC.

Extension allows you to create, update and remove Roles, Permissions and Rules, and also contains useful builder to easy roles creation.

**A warning**: if you using constants for Roles, Permissions or Rules names, you should not to use it inside migration classes! Use simple strings with it names. Constants values during application development can change, but you old migrations should stay persistent.

Install
-------

[](#install)

Via Composer

```
$ composer require erickskrauch/yii2-rbac-migration
```

Usage
-----

[](#usage)

First of all we must *use trait*. You can do it within the migration file:

```
