PHPackages                             vasadibt/yii2-action-resolver - 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. [Framework](/categories/framework)
4. /
5. vasadibt/yii2-action-resolver

ActiveYii2-extension[Framework](/categories/framework)

vasadibt/yii2-action-resolver
=============================

Extension for Yii Framework 2.0 what extending the controllers and you can use simply the action resolvers.

1.0.0(3y ago)06MITPHPPHP &gt;=7.4.0

Since Apr 19Pushed 3y ago1 watchersCompare

[ Source](https://github.com/vasadibt/yii2-action-resolver)[ Packagist](https://packagist.org/packages/vasadibt/yii2-action-resolver)[ RSS](/packages/vasadibt-yii2-action-resolver/feed)WikiDiscussions main Synced 1mo ago

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

YII2 - Action Resolver
======================

[](#yii2---action-resolver)

Extend Yii2 controller actions with custom resolved classes

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

[](#installation)

Package is available on [Packagist](https://packagist.org/packages/vasadibt/yii2-action-resolver), you can install it using [Composer](https://getcomposer.org).

```
composer require vasadibt/yii2-action-resolver "^1.0"
```

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

```
"vasadibt/yii2-action-resolver": "^1.0"

```

Dependencies
------------

[](#dependencies)

- PHP 7.4+
- [yiisoft/yii2](https://github.com/yiisoft/yii2)

Usage
-----

[](#usage)

You need to add `ActionResolveTrait` trait to your controller. THis will be extending your `bindInjectedParams` method with a new event trigger. After that you can use easily the behavior:

```
use vasadibt\actionresolver\ActionResolveTrait;
use vasadibt\actionresolver\ResolvableActionBehavior;

class CashregisterApiController extends \yii\web\Controller
{
    use ActionResolveTrait;

    public function behaviors()
    {
        return [
            'resolver' => [
                'class' => ResolvableActionBehavior::class,
                'resolvers' => [
                    // Define a new resolvable
                    [
                        'resolvable' => User::class, // User class need to implement `\vasadibt\actionresolver\ResolvableInterface`
                        // Optional you can filter the fiering action
                        // 'actions' => ['*'],
                        // 'actions' => ['view', 'update', 'delete'],
                    ],

                    // or a simple way
                    User::class,

                    // or you can use callable resolving
                    [
                        'resolvable' => Post::class,
                        'actions' => ['update'],
                        'callable' => function(Request $request, Action $action){
                            $post = static::findOne($request->post('id'));
                            if($post === null){
                                throw new NotFoundHttpException(Yii::t('yii', 'Page not found.'));
                            }
                            if (!Yii::$app->user->can('updatePost', ['post' => $post])) {
                                throw new ForbiddenHttpException(Yii::t('yii', 'You are not allowed to perform this action.'));
                            }
                            return $post;
                        },
                    ],
                ],
            ],
        ];
    }

    public function actionView(User $user)
    {
        return $this->render('view', ['user' => $user]);
    }

    public function actionUpdate(Request $request, Post $post)
    {
        if($post->load($request->post())){
            $post->save();
            return $this->redirect(['index']);
        }
        return $this->render('update', ['model' => $post]);
    }

    public function actionDelete(Post $post)
    {
        $post->delete();
        return $this->redirect(['index']);

    }
}
```

```
use vasadibt\actionresolver\ResolvableInterface;

class User implements ResolvableInterface
{
    public function resolve($request, $action)
    {
        if($model = static::findOne($request->post('id'))){
            return $model;
        }
        throw new NotFoundHttpException(Yii::t('yii', 'Page not found.'));
    }
}
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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

1119d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bd772ac033b1b9bb80d456c9756d4c7be31d9cd1e372aee460c3b39f1d98698e?d=identicon)[vasadibt](/maintainers/vasadibt)

---

Top Contributors

[![vasadibt](https://avatars.githubusercontent.com/u/9213794?v=4)](https://github.com/vasadibt "vasadibt (1 commits)")

---

Tags

yii2extensionyiiresolver

### Embed Badge

![Health badge](/badges/vasadibt-yii2-action-resolver/health.svg)

```
[![Health](https://phpackages.com/badges/vasadibt-yii2-action-resolver/health.svg)](https://phpackages.com/packages/vasadibt-yii2-action-resolver)
```

###  Alternatives

[skeeks/cms

SkeekS CMS — control panel and tools based on php framework Yii2

13825.6k47](/packages/skeeks-cms)

PHPackages © 2026

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