2017 © Pedro Peláez
 

yii2-extension yii2-taxonomy

Yii2 Taxonomy

image

nkostadinov/yii2-taxonomy

Yii2 Taxonomy

  • Tuesday, May 23, 2017
  • by phreakbg
  • Repository
  • 4 Watchers
  • 5 Stars
  • 201 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 2 Versions
  • 3 % Grown

The README.md

Yii2 Taxonomy

Build Status Scrutinizer Code Quality, (*1)

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., (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

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

or add, (*5)

"nkostadinov/yii2-taxonomy": "*"

to the require section of your composer.json file., (*6)

Then you need to configure the taxonomy component to your configuration file., (*7)

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

Finally you need to run the initial migration, (*8)

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

Usage

If you need to use the management interface for taxonomies you must add the Taxonomy module to you configuration, (*9)

    '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., (*10)

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');, (*11)

//Adding terms (e.g. tags) to an object with id $post_id $taxonomy->addTerm($post_id, ['read', 'important', 'new']);, (*12)

//Deleting tags $taxonomy->removeTerm($post_id, ['important', 'new']);, (*13)

//Retrieving tags $taxonomy->getTerms($this->id); // returns ['read'], (*14)

Taxonomies

The bundled taxonomies with these package are :, (*15)

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., (*16)

PropertyTerm

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

CategoryTerm

Ability to create hierarchical terms (e.g. categories), (*18)

The Versions

23/05 2017

dev-master

9999999-dev

Yii2 Taxonomy

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nikola Kostadinov

extension yii2 taxonomy

23/05 2017

dev-feature/vue

dev-feature/vue

Yii2 Taxonomy

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nikola Kostadinov

extension yii2 taxonomy