PHPackages                             demmonico/yii2-traits - 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. demmonico/yii2-traits

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

demmonico/yii2-traits
=====================

Yii2 traits library

v1.2.1(9y ago)13.5k↓33.3%12MITPHPPHP &gt;5.5.0

Since Aug 22Pushed 7y ago1 watchersCompare

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

READMEChangelog (7)Dependencies (2)Versions (8)Used By (2)

Yii2 traits library
===================

[](#yii2-traits-library)

Description
-----------

[](#description)

Yii2 traits library which used in web-application development.

Composition
-----------

[](#composition)

### AjaxValidationTrait

[](#ajaxvalidationtrait)

Trait add perform ajax validation to models and forms.

##### Usage:

[](#usage)

use [demmonico\\models\\Model](https://github.com/demmonico/yii2-models) as parent or set in you model

```
use AjaxValidationTrait;
```

in controller

```
if (!is_null($validate = $model->performAjaxValidation()))
            return $validate;
```

### ConstantTrait

[](#constanttrait)

***!!! This trait is DEPRECATED*** Use [demmonico/reflection](https://github.com/demmonico/reflection) instead!!!

Trait generates array of class constant labels or one label by constant value

##### Usage:

[](#usage-1)

set in your model

```
use ConstantTrait;

const NAME_FIRST = 1;
const NAME_SECOND = 2;
```

then anywhere get array values and names of constants:

```
ModelName::getName();   // returns array(1 => 'First', 2 => 'Second');
```

or

```
$model->getName();      // returns array(1 => 'First', 2 => 'Second');
```

Whether get name by constant value:

```
ModelName::getName(ModelName::NAME_FIRST);   // returns 'First';
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

Every ~8 days

Total

7

Last Release

3505d ago

### Community

Maintainers

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

---

Top Contributors

[![demmonico](https://avatars.githubusercontent.com/u/10497315?v=4)](https://github.com/demmonico "demmonico (8 commits)")

---

Tags

traityii2extensionyiicomponent

### Embed Badge

![Health badge](/badges/demmonico-yii2-traits/health.svg)

```
[![Health](https://phpackages.com/badges/demmonico-yii2-traits/health.svg)](https://phpackages.com/packages/demmonico-yii2-traits)
```

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