PHPackages                             misterspelik/yii2-role-activeform - 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. misterspelik/yii2-role-activeform

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

misterspelik/yii2-role-activeform
=================================

Role based ActiveForm allowing field to be editable or readoonly depending on role

v0.1.0(8y ago)094MITPHPPHP &gt;=5.6.0

Since Feb 7Pushed 8y ago1 watchersCompare

[ Source](https://github.com/misterspelik/yii2-role-activeform)[ Packagist](https://packagist.org/packages/misterspelik/yii2-role-activeform)[ Docs](https://github.com/misterspelik/yii2-role-activeform)[ RSS](/packages/misterspelik-yii2-role-activeform/feed)WikiDiscussions master Synced yesterday

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

Yii2 Role based ActiveForm
==========================

[](#yii2-role-based-activeform)

---

This is a package to be used with Yii2 form widget. Usage is totally the same as Yii2 ActiveForm widget.

### Installation

[](#installation)

---

composer require misterspelik/yii2-role-activeform

### Configuration

[](#configuration)

---

For example you have model `User` and you want to allow edit all fields to `admin` role but don't want to allow edit name field to role `manager`. For that you need to define `roleRules` method with such content

```
public function roleRules()
{
    return [
        [
            'allow' => true,
            'attributes' => ['*'],
            'roles' => ['admin']
        ],
        [
            'allow' => false,
            'attributes' => ['name'],
            'roles' => ['manager']
        ],
    ];
}
```

### Usage

[](#usage)

---

To include widget to your form just use this namespace and create $form instance

```
use misterspelik\widgets\RoleActiveForm;

$form = RoleActiveForm::begin([
   'role' =>  'manager' //current user role
]);

echo $form->field($model, 'name')->textInput(['maxlength' => true]);
// some code here

RoleActiveForm::end();
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

3017d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1f6e5ed1da722746fea0d5cfa7d98174419bfc9ed934dcdcb4e3b59d6f90c840?d=identicon)[misterspelik](/maintainers/misterspelik)

---

Top Contributors

[![misterspelik](https://avatars.githubusercontent.com/u/3395617?v=4)](https://github.com/misterspelik "misterspelik (3 commits)")

---

Tags

yii2extensionactiveformrolereadonlydisabled

### Embed Badge

![Health badge](/badges/misterspelik-yii2-role-activeform/health.svg)

```
[![Health](https://phpackages.com/badges/misterspelik-yii2-role-activeform/health.svg)](https://phpackages.com/packages/misterspelik-yii2-role-activeform)
```

###  Alternatives

[kakadu-dev/yii2-jwt-auth

Extension provide JWT auth for Yii2

105.8k](/packages/kakadu-dev-yii2-jwt-auth)

PHPackages © 2026

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