Download the PHP package justinvoelker/yii2-tagging without Composer

On this page you can find all versions of the php package justinvoelker/yii2-tagging. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yii2-tagging

Tagging for Yii2

Turn delimited data into tags

There are multiple extensions for brining tagging functionality into Yii but Tagging aims to be the simplest. Built for Yii2, Tagging does not use additional tables, models, or relationships to store or manage tags or how often they appear. Instead, it works with an existing field of your choosing and turns its contents into tags.

We'll use the following posts table as an example.

id post_title post_body tags
1 My first post! body of new blog welcome
2 Why Tagging is great some more content yii2-tagging,tutorial
3 Advanced Tagging tips most recent post yii2-tagging,tutorial,advanced

Tagging includes two classes: TaggingQuery and TaggingWidget. TaggingQuery returns a php array which can be used in form's select field or as input to TaggingWidget which can display the tags as a list or tag cloud.

Keep in mind that your tags don't need to be comma-delimited. You can use practically any delimiter you like!

Installation

Install the extension

The preferred way to install this extension is through composer.

Either run

or add

to the require section of your composer.json file.

Styles

Follow one of the directions below to use the styles necessary for the tag_cloud

Option 1: Manually combine stylesheets

Open your the vendors\justinvoelker\yii2-tagging\css directory and add the styles found in tagging.css to your own stylesheet.

Option 2: Include the delivered asset bundle

Add justinvoelker\tagging\TaggingAsset as a dependency in your assets\AppAsset file. It should look similar to the following:

Usage

TaggingQuery

To create a php array of key=>value pairs (where key is the tag and value is the frequency of that tag), use TaggingQuery:

TaggingWidget

To create a tag cloud or list, use TaggingWidget:

TaggingQuery and TaggingWidget

If necessary, you can combine the two. If you have multiple widgets on the same page that will use roughly the same set of data, simple pass the results of an initial TaggingQuery into another TaggingQuery for further limiting or ordering as follows:

The above example will only use one database query but will display two TaggingWidgets. The first will be a tag cloud of tags sorted by name whereas the second will be an unordered list (ul) sorted from most to least frequent.

Available Options

Many options are available for selecting and formatting the data and results. The following examples show which options are available. Exploring the code will give further descriptions of each option.

TaggingQuery

Only select and from or an array of items are required. If all three are specified, the items values will be used. Note that exclude and includeOnly would likely not be used at the same time which is why includeOnly is commented out in the examples below. Also commented out for this example is items.

Since TaggingQuery extends yii\db\Query you can use any other properties available to that class as well. While using where may come in handy, be careful not to use properties such as distinct which could have unintended consequences.

The following TaggingQuery would result in an array of the 50 most frequent comma-separated tags from the post table, except for the 'junk' tag, displayed alphabetically.

TaggingWidget

Only items is required.

All of the selecting, limiting, sorting, and excluding/including of tags is performed by TaggingQuery. Once a list of items is returned from TaggingQuery, it may be passed into a TaggingWidget for display.

Continuing with the previous example, the following TaggingWidget would result in the previously selected tags being displayed in a tag cloud whose text will be justified, with tags ranging in size from 14-22px, and linking to pages in the format of /index.php?r=post/index&tag=TAGNAME


All versions of yii2-tagging with dependencies

PHP Build Version
Package Version
Requires yiisoft/yii2 Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package justinvoelker/yii2-tagging contains the following files

Loading the files please wait ....