PHPackages                             nkostadinov/yii2-taxonomy - 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. nkostadinov/yii2-taxonomy

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

nkostadinov/yii2-taxonomy
=========================

Yii2 Taxonomy

82972[1 PRs](https://github.com/nkostadinov/yii2-taxonomy/pulls)PHP

Since May 23Pushed 5y ago4 watchersCompare

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

READMEChangelogDependenciesVersions (3)Used By (0)

Yii2 Taxonomy
=============

[](#yii2-taxonomy)

[![Build Status](https://camo.githubusercontent.com/07dda7fc281e390b44e531b8d44d4ee5df636b48fcb4278b3be4531521c123fd/68747470733a2f2f7472617669732d63692e6f72672f6e6b6f73746164696e6f762f796969322d7461786f6e6f6d792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/nkostadinov/yii2-taxonomy)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/8be911c4ba2d2322bb0be590833881a1d0d475032c15891a7a00eb5d042c4402/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e6b6f73746164696e6f762f796969322d7461786f6e6f6d792f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/nkostadinov/yii2-taxonomy/?branch=master)

Yii2 Taxonomy management. A component which adds generic taxonomy functionalities to your application. The component comes with a couple of term definitions(tags, properties). These additional info is added via addition tables created by the extension. The extension also offers a search behavior which can be attached to AR instances for easier searching.

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist nkostadinov/yii2-taxonomy "*"

```

or add

```
"nkostadinov/yii2-taxonomy": "*"

```

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

Then you need to configure the taxonomy component to your configuration file.

```
    'components' => [
        .......
        'taxonomy' => [
            'class' => 'nkostadinov\taxonomy\Taxonomy',
        ],
        .......

```

Finally you need to run the initial migration

```
yii migrate --migrationPath=@nkostadinov/taxonomy/migrations

```

Usage
-----

[](#usage)

If you need to use the management interface for taxonomies you must add the Taxonomy module to you configuration

```
    'modules' => [
        ......
        'taxonomy' => [
            'class' => 'nkostadinov\taxonomy\Module'
        ],

```

It is recommended to use the taxonomy *MODULE* only on dev environment to create the taxonomies just like gii. When you add a taxonomy via the interface the component creates a migration so you can execute it on production later.

Sample usage (tags): //return a taxonomy object used to manipulate this taxonomy(taxonomy must be defined before that and the migrations executed)

```
$taxonomy = Yii::$app->taxonomy->getTerm('post_tags');

```

//Adding terms (e.g. tags) to an object with id $post\_id

```
$taxonomy->addTerm($post_id, ['read', 'important', 'new']);

```

//Deleting tags

```
$taxonomy->removeTerm($post_id, ['important', 'new']);

```

//Retrieving tags

```
$taxonomy->getTerms($this->id);

```

// returns \['read'\]

Taxonomies
----------

[](#taxonomies)

The bundled taxonomies with these package are :

### TagTerm

[](#tagterm)

Basically tag represent taxonomies which are added to an object. They do not have a value. You can add multiple tags to an item.

### PropertyTerm

[](#propertyterm)

They are the same as tag terms but they DO have a value. You can add multiple properties to an item.

### CategoryTerm

[](#categoryterm)

Ability to create hierarchical terms (e.g. categories)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.7% 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/c315c9f4a7260ad3357e2b049a7574af2796be04a20bf0cfa4d733e164d1ed70?d=identicon)[phreakbg](/maintainers/phreakbg)

---

Top Contributors

[![nkostadinov](https://avatars.githubusercontent.com/u/1700251?v=4)](https://github.com/nkostadinov "nkostadinov (74 commits)")[![traykovn](https://avatars.githubusercontent.com/u/15726779?v=4)](https://github.com/traykovn "traykovn (4 commits)")[![ntraykov](https://avatars.githubusercontent.com/u/1255356?v=4)](https://github.com/ntraykov "ntraykov (1 commits)")

---

Tags

phptaxonomyyii2yii2-extensionyii2-taxonomy

### Embed Badge

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

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

PHPackages © 2026

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