Download the PHP package macfly/yii2-taxonomy without Composer
On this page you can find all versions of the php package macfly/yii2-taxonomy. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download macfly/yii2-taxonomy
More information about macfly/yii2-taxonomy
Files in macfly/yii2-taxonomy
Package yii2-taxonomy
Short Description Extend Yii2-taxonomy-term (by mhndev) by adding term definition (tags, properties). The extension complete the original module by adding behavior to add term, properties and tags to your model.
License BSD-3-Clause
Informations about the package yii2-taxonomy
yii2-taxonomy
Yii2 Taxonomy management. A component which adds generic taxonomy functionalities to your application. The component comes with a couple of term definitions(tags, properties). Those definitions can be enable on any models by adding the chossen behavior. This extension depends of yii2-taxonomy-term (by mhndev).
Installation
The preferred way to install this extension is through composer.
Either run
or add
to the require section of your composer.json
file.
Migration
Usage
Configuring to manage Taxonomy and Term in web interface
Configure config/web.php as follows
- Pretty Url's /taxonomy
- No pretty Url's index.php?r=taxonomy
Configuring to use Term
Configure model as follows
get terms of an entity
set terms of an entity (will remove all other term)
detach a term from an entity
check if term exist on entity
add term to an entity (will keep others term)
Configuring to use Property and Term
Properties are taxonomy of defined 'type' and they have name and value. You can add multiple properties to an item. And a property can have multiple 'name' and values to an item.
Configure model as follows
get terms for property 'env' of an entity
set terms for property 'env' of an entity (will remove all other term for property 'env')
detach property 'env' by is name and value from an entity (if you want to detach it by term, just use delTerm($term))
check if property 'env' exist by name and value on entity (if you want to check it by term, just use hasTerm($term))
add property 'env' by name and value to an entity (will keep others term, if you want to add it by term, just use addTerm($term))
Configuring to use Tags, Property and Term
Basically tags represent properties of type 'tag' and name 'name'. You can add multiple tags to an item.
Configure model as follows
You can change 'tag' taxonomy type and name for a specific model with the following :
get tags of an entity
set tags of an entity (will remove all other term)
detach a tag from an entity
check if tag exist on entity
add tag to an entity (will keep others tag)
Configuring to purge unused Term
Basically unused Term will be delete in the period of time (default is 30 day) it's help to remove useless tag.
Configure route for action config/console.php as follows:
Default term will be delete if _updatedat later than one month, if you want to define specific period time, just specify it on command line:
And you can add a cron job (http://www.crontab-generator.org/) to run at 00:00 on every Sunday with some controller action like this:
on Linux:
on Window Task Schedule: