PHPackages                             sam-it/yii2-magic - 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. sam-it/yii2-magic

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

sam-it/yii2-magic
=================

Improvements to Yii2 framework.

v5.0.0(5y ago)1871.7k—9.1%2[1 issues](https://github.com/SAM-IT/yii2-magic/issues)1MITPHP

Since Feb 15Pushed 5y ago2 watchersCompare

[ Source](https://github.com/SAM-IT/yii2-magic)[ Packagist](https://packagist.org/packages/sam-it/yii2-magic)[ RSS](/packages/sam-it-yii2-magic/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (1)Versions (23)Used By (1)

[![Latest Stable Version](https://camo.githubusercontent.com/e3b189ca600f840aaf318f12d2c335b8343933d20ebc5882cb1fc319a5419813/68747470733a2f2f706f7365722e707567782e6f72672f73616d2d69742f796969322d6d616769632f762f737461626c65)](https://packagist.org/packages/sam-it/yii2-magic)[![Total Downloads](https://camo.githubusercontent.com/4d73639c9e35448d25b2352c9b1980b8578b6da1911fd9c83e2c0bb345599aa8/68747470733a2f2f706f7365722e707567782e6f72672f73616d2d69742f796969322d6d616769632f646f776e6c6f616473)](https://packagist.org/packages/sam-it/yii2-magic)[![Latest Unstable Version](https://camo.githubusercontent.com/df25668317e43eb6563a9f908d17d617efc8ccd3d09a1f8e585fe1a193636a79/68747470733a2f2f706f7365722e707567782e6f72672f73616d2d69742f796969322d6d616769632f762f756e737461626c65)](https://packagist.org/packages/sam-it/yii2-magic)[![License](https://camo.githubusercontent.com/f07cb30b988f16055d8d40d52767f2deaa0bca1563ce0a803252c594d1b2a6e0/68747470733a2f2f706f7365722e707567782e6f72672f73616d2d69742f796969322d6d616769632f6c6963656e7365)](https://packagist.org/packages/sam-it/yii2-magic)[![Monthly Downloads](https://camo.githubusercontent.com/78c4823c474b085b0226faf129f5c847e76669cbe162ee1443fe0514a2fef5da/68747470733a2f2f706f7365722e707567782e6f72672f73616d2d69742f796969322d6d616769632f642f6d6f6e74686c79)](https://packagist.org/packages/sam-it/yii2-magic)[![Daily Downloads](https://camo.githubusercontent.com/4c001b8f521df0affcca066dcb3f6407f6b50bbf0da75d92670e6dc7004b34d7/68747470733a2f2f706f7365722e707567782e6f72672f73616d2d69742f796969322d6d616769632f642f6461696c79)](https://packagist.org/packages/sam-it/yii2-magic)

yii2-magic
==========

[](#yii2-magic)

Improvements for Yii2 that make it more "magic".

ActionInjectionTrait
====================

[](#actioninjectiontrait)

Use this trait in your controller to get dependency injection in controller actions.

```
use \SamIT\Yii2\Traits\ActionInjectionTrait;

```

HighlightUnsafeAttributesTrait
==============================

[](#highlightunsafeattributestrait)

Use this trait in your form to highlight unsafe attributes.

```
use \SamIT\Yii2\Traits\HighlightUnsafeAttributesTrait;

```

SingleTableInheritanceTrait
===========================

[](#singletableinheritancetrait)

Use this trait in your active record model to implement single table inheritance.

```
use \SamIT\Yii2\Traits\SingleTableInheritanceTrait;

protected static function inheritanceConfig()
{
    return [
        'map' => [
            PartnerProject::class => 'partner'
        ],
        'column' => 'type'
    ];
}

```

This trait uses a different query object. If you use your own `ActiveQuery` implementation, use `SingleTableInheritanceQueryTrait`.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 87.5% 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 ~80 days

Recently: every ~263 days

Total

22

Last Release

2054d ago

Major Versions

v1.5.1 → v2.0.02017-11-03

v2.2.0 → v3.0.02020-05-07

v3.0.0 → v4.0.02020-08-13

v4.0.0 → v5.0.02020-10-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/18b13c534e3812b66a72645fe215301b54fc4d288f6396fee9385b681e27da18?d=identicon)[SamMousa](/maintainers/SamMousa)

---

Top Contributors

[![SamMousa](https://avatars.githubusercontent.com/u/547021?v=4)](https://github.com/SamMousa "SamMousa (35 commits)")[![joester89](https://avatars.githubusercontent.com/u/9624366?v=4)](https://github.com/joester89 "joester89 (5 commits)")

### Embed Badge

![Health badge](/badges/sam-it-yii2-magic/health.svg)

```
[![Health](https://phpackages.com/badges/sam-it-yii2-magic/health.svg)](https://phpackages.com/packages/sam-it-yii2-magic)
```

###  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)
