PHPackages                             jakharbek/yii2-topics - 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. jakharbek/yii2-topics

ActiveYii2-extension

jakharbek/yii2-topics
=====================

Topics

131PHP

Since Feb 28Pushed 8y agoCompare

[ Source](https://github.com/jakharbek/yii2-topics)[ Packagist](https://packagist.org/packages/jakharbek/yii2-topics)[ RSS](/packages/jakharbek-yii2-topics/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Topics
======

[](#topics)

Topics

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist jakharbek/yii2-topics "*"

```

or add

```
"jakharbek/yii2-topics": "*"

```

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

Usage
-----

[](#usage)

Once the extension is installed, simply use it in your code by :

You need to connect a controller or an action to the controller

controller

```
    'controllerMap' => [
        'topics' => 'jakharbek\topics\controllers\TopicsController'
    ],
```

action

```
   public function actions()
       {
           return [
               'topics' => [
                   'class' => 'jakharbek\topics\actions\TopicsAction'
               ]
           ];
       }
```

You must have an extension

```
jakharbek/yii2-langs

```

You need to connect i18n for translations

```
 'jakhar-topics' => [
                    'class' => 'yii\i18n\PhpMessageSource',
                    'basePath' => '@vendor/jakharbek/yii2-topics/src/messages',
                    'sourceLanguage' => 'en',
                    'fileMap' => [
                        'jakhar-topics'       => 'main.php',
                    ],
                ],
```

and migrate the database

```
yii migrate --migrationPath=@vendor/jakharbek/yii2-topics/src/migrations
```

Update (Active Record) - Single
-------------------------------

[](#update-active-record---single)

example with Posts elements

You must connect behavior to your database model (Active Record)

```
 'topic_model'=> [
                        'class' => TopicModelBehavior::className(),
                        'attribute' => 'Topicsform',
                        'separator' => ',',
                        ],
```

example

```
use jakharbek\topics\behaviors\TopicModelBehavior;

        class Posts extends ActiveRecord
        {
            private $_topicsform;

            public function behaviors()
            {
                 ...
                        'topic_model'=> [
                        'class' => TopicModelBehavior::className(),
                        'attribute' => 'topicsform',
                        'separator' => ',',
                        ],
                 ...
            }

            ...

            public function getTopicsform(){
                return $this->_topicsform;
            }
            public function setTopicsform($value){
                return $this->_topicsform = $value;
            }
        }
```

Afterwards you need to add your widget form.

```
jakharbek\topics\widgets\TopicsWidget::widget
```

example

```
echo jakharbek\topics\widgets\TopicsWidget::widget([
  'selected' => $model->topicsSelected(),
  'model_db' => $model,'name' => 'Posts[topicsform]'
  ]);
```

and of course do not forget to prescribe links for your model

```
    public function getPoststopics()
    {
        return $this->hasMany(Poststopics::className(), ['post_id' => 'post_id']);
    }

    public function getTopics()
    {
        return $this->hasMany(Topics::className(), ['id' => 'id'])->viaTable('poststopics', ['post_id' => 'post_id']);
    }
```

It's all!

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

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

---

Top Contributors

[![jakharbek](https://avatars.githubusercontent.com/u/31648260?v=4)](https://github.com/jakharbek "jakharbek (2 commits)")

### Embed Badge

![Health badge](/badges/jakharbek-yii2-topics/health.svg)

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

PHPackages © 2026

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