PHPackages                             afzalroq/yii2-unit - 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. afzalroq/yii2-unit

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

afzalroq/yii2-unit
==================

Yii2 unit extension

v1.1.0(5y ago)048BSD-3-ClausePHP

Since Nov 25Pushed 5y ago2 watchersCompare

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

READMEChangelogDependencies (8)Versions (6)Used By (0)

yii2-unit extension
===================

[](#yii2-unit-extension)

The extension allows manage block of html contents, files, images.

### Installation

[](#installation)

- Install with composer:

```
composer require afzalroq/yii2-unit "^1.1"
```

- **After composer install** run console command for create tables:

```
php yii migrate/up --migrationPath=@vendor/afzalroq/yii2-unit/migrations
```

- Setup in common config storage and language configurations.

> language indexes related with database columns.

> Admin panel tabs render by array values order.

> Begin id param value from 0.

```
'modules' => [
    'unit' => [ // don`t change module key
        'class' => '@afzalroq\unit\Module',
        'storageRoot' => $params['staticPath'],
        'storageHost' => $params['staticHostInfo'],
        'thumbs' => [ // 'sm' and 'md' keys are reserved
            'admin' => ['width' => 128, 'height' => 128],
            'thumb' => ['width' => 320, 'height' => 320],
        ],
        'languages' => [
            'ru' => [
                'id' => 0,
                'name' => 'Русский',
            ],
            'uz' => [
                'id' => 1,
                'name' => 'English',
            ],
        ],
    ],
]
```

- In admin panel add belove links for manage categories and blocks:

```
/unit/categories/index
/unit/units/index?slug=your_category_slug_name
```

> For using BlockController actions you must manual specify their category slug in route.

\###Examples

Extension registers next language arrays to Yii::$app-&gt;params\[\] for use in views:

```
\Yii::$app->params['cms']['languageIds'][$prefix] = $language['id'];
[
    'en' => 2,
    'ru' => 1,
    ...
]

\Yii::$app->params['cms']['languages'][$prefix] = $language['name'];
[
    'en' => 'English',
    ...
]

\Yii::$app->params['cms']['languages2'][$language['id']] = $language['name'];
[
    2 => 'English',
    ...
]
```

\###Frontend widgets integration

> get all blocks by category slug

```
afzalroq\unit\entities\Unit::getBySlug($slug)

```

> get each block data for current app language:

```
$units = Unit::getBySlug($slug);
foreach ($units as $unit) {
    echo ($blockObject->getModelByType())->get();
}

```

---

> TODO

- Copy from extension root directory example widgets for frontend integration

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% 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 ~1 days

Total

5

Last Release

1987d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/62251035?v=4)[afzalroq](/maintainers/afzalroq)[@afzalroq](https://github.com/afzalroq)

---

Top Contributors

[![DilmurodAxmadov](https://avatars.githubusercontent.com/u/59030669?v=4)](https://github.com/DilmurodAxmadov "DilmurodAxmadov (5 commits)")[![Abdualiym](https://avatars.githubusercontent.com/u/10773154?v=4)](https://github.com/Abdualiym "Abdualiym (1 commits)")

---

Tags

frameworkhtmlyii2blocksinfo

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/afzalroq-yii2-unit/health.svg)

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

###  Alternatives

[skeeks/cms

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

13825.6k47](/packages/skeeks-cms)[beaten-sect0r/yii2-core

Yii2 Core project template

771.1k](/packages/beaten-sect0r-yii2-core)[tecnocen/yii2-formgenerator

Yii 2 Library to configure form generator

145.7k](/packages/tecnocen-yii2-formgenerator)

PHPackages © 2026

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