PHPackages                             mhndev/yii2-taxonomy-term - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mhndev/yii2-taxonomy-term

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

mhndev/yii2-taxonomy-term
=========================

taxonomy term implementation in Yii2

1.0.5(9y ago)41.7k1[1 PRs](https://github.com/mhndev/yii2-taxonomy-term/pulls)1MITPHP

Since Aug 30Pushed 9y ago2 watchersCompare

[ Source](https://github.com/mhndev/yii2-taxonomy-term)[ Packagist](https://packagist.org/packages/mhndev/yii2-taxonomy-term)[ RSS](/packages/mhndev-yii2-taxonomy-term/feed)WikiDiscussions develop Synced 2mo ago

READMEChangelogDependencies (2)Versions (8)Used By (1)

Taxonomy Term
=============

[](#taxonomy-term)

taxonomy term implementation in Yii2

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

[](#installation)

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

Either run

```
composer require --prefer-dist mhndev/yii2-taxonomy-term "1.*"

```

or add

```
"mhndev/yii2-taxonomy-term": "1.*"

```

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

Execute Migrations
------------------

[](#execute-migrations)

```
php yii migrate --migrationPath=@vendor/mhndev/yii2-taxonomy-term/src/migrations

```

Usage
-----

[](#usage)

user mhndev\\yii2TaxonomyTerm\\traits\\TermableTrait in each Model which you want to use taxonomy-term for

### example

[](#example)

##### Post Model

[](#post-model)

```
class Post extends ActiveRecord
{

    use TermableTrait;

    /**
     * @return string
     */
    public static function tableName()
    {
        return 'posts';

    }

    /**
     * @return array
     */
    public function rules()
    {
        return [
            [['title'], 'required'],
            [['text'], 'required'],
        ];
    }

}
```

### attach a term to an entity

[](#attach-a-term-to-an-entity)

```
    $term = Term::findOne(['id'=>1]);
    $post = Post::findOne(['id'=>1]);
    $post->attachTerm($term);
```

### detach a term from an entity

[](#detach-a-term-from-an-entity)

```
    $term = Term::findOne(['id'=>1]);
    $post = Post::findOne(['id'=>1]);
    $post->detachTerm($term);
```

### list terms of an entity

[](#list-terms-of-an-entity)

```
    $post = Post::findOne(['id'=>1]);
    $post->listTerms();
```

### get term tree

[](#get-term-tree)

```
    $term = Term::findOne(['id'=>1]);
    $term->getTree();
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity68

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 ~0 days

Total

6

Last Release

3541d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5c3e5d182214e2e6b989a2230bcae80b2107b088da1c6dbea6f6f8d28702e272?d=identicon)[majidphpdeveloper](/maintainers/majidphpdeveloper)

---

Top Contributors

[![mhndev](https://avatars.githubusercontent.com/u/5164182?v=4)](https://github.com/mhndev "mhndev (15 commits)")

---

Tags

categorytagstaxonomy-termsyii2extensiontagcategorytaxonomyterm

### Embed Badge

![Health badge](/badges/mhndev-yii2-taxonomy-term/health.svg)

```
[![Health](https://phpackages.com/badges/mhndev-yii2-taxonomy-term/health.svg)](https://phpackages.com/packages/mhndev-yii2-taxonomy-term)
```

###  Alternatives

[sonata-project/classification-bundle

Symfony SonataClassificationBundle

913.2M20](/packages/sonata-project-classification-bundle)[sjaakp/yii2-taggable

Manage tags of ActiveRecord in Yii2.

3030.6k](/packages/sjaakp-yii2-taggable)[akiraz2/yii2-blog

Simple, configurable blog module for Yii2 (post, comment, nested category, tags). + frontend, backend. + SEO! (Opengraph, Schema.org)

906.7k](/packages/akiraz2-yii2-blog)[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1357.2k7](/packages/richardfan1126-yii2-js-register)

PHPackages © 2026

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