PHPackages                             thaonv/laravel-tagging - 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. thaonv/laravel-tagging

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

thaonv/laravel-tagging
======================

Thaonv Taggable.

017PHP

Since Jul 3Pushed 9y ago1 watchersCompare

[ Source](https://github.com/thaonguyen90/thaonv-tagging)[ Packagist](https://packagist.org/packages/thaonv/laravel-tagging)[ RSS](/packages/thaonv-laravel-tagging/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Taggable Trait
======================

[](#laravel-taggable-trait)

[![Latest Stable Version](https://camo.githubusercontent.com/a95d026344e0e235c66441d7b564eb2a7ed3c106ecc22c49091342e2c44f0e06/68747470733a2f2f706f7365722e707567782e6f72672f7274636f6e6e65722f6c61726176656c2d74616767696e672f762f737461626c652e737667)](https://packagist.org/packages/rtconner/laravel-tagging)[![Total Downloads](https://camo.githubusercontent.com/05fd09fdc43114a1ace5220f04231a2cd32fec473fe73ad8c036b5a75b868c4e/68747470733a2f2f706f7365722e707567782e6f72672f7274636f6e6e65722f6c61726176656c2d74616767696e672f646f776e6c6f6164732e737667)](https://packagist.org/packages/rtconner/laravel-tagging)[![License](https://camo.githubusercontent.com/f85fe25813ded52569ad3a3980063f4eb6fcbd8cc600e94118af29ad569f391c/68747470733a2f2f706f7365722e707567782e6f72672f7274636f6e6e65722f6c61726176656c2d74616767696e672f6c6963656e73652e737667)](https://packagist.org/packages/rtconner/laravel-tagging)[![Build Status](https://camo.githubusercontent.com/d263bef6dba89b3107535e9b32c0bd752cb61a8e65e6c9d62e2163e128d8f732/68747470733a2f2f7472617669732d63692e6f72672f7274636f6e6e65722f6c61726176656c2d74616767696e672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/rtconner/laravel-tagging)

This package is not meant to handle javascript or html in any way. This package handles database storage and read/writes only.

There are no real limits on what characters can be used in a tag. It uses a slug transform to determine if two tags are identical ("sugar-free" and "Sugar Free" would be treated as the same tag). Tag display names are run through Str::title()

[Laravel 5 Documentation](https://github.com/rtconner/laravel-tagging/tree/laravel-5)
[Laravel 4 Documentation](https://github.com/rtconner/laravel-tagging/tree/laravel-4)

#### Composer Install (for Laravel 5)

[](#composer-install-for-laravel-5)

```
composer require thaonguyen90/laravel-tagging "~2.0"
```

#### Install and then Run the migrations

[](#install-and-then-run-the-migrations)

The service provider does not load on every page load, so it should not slow down your app.

```
'providers' => array(
	\Conner\Tagging\Providers\TaggingServiceProvider::class,
);
```

```
php artisan vendor:publish --provider="Conner\Tagging\Providers\TaggingServiceProvider"
php artisan migrate
```

After these two steps are done, you can edit config/tagging.php with your prefered settings.

#### Setup your models

[](#setup-your-models)

```
class Article extends \Illuminate\Database\Eloquent\Model {
	use \Conner\Tagging\Taggable;
}
```

#### Quick Sample Usage

[](#quick-sample-usage)

```
$article = Article::with('tagged')->first(); // eager load

foreach($article->tags as $tag) {
	echo $tag->name . ' with url slug of ' . $tag->slug;
}

$article->tag('Gardening'); // attach the tag

$article->untag('Cooking'); // remove Cooking tag
$article->untag(); // remove all tags

$article->retag(array('Fruit', 'Fish')); // delete current tags and save new tags

$article->tagNames(); // get array of related tag names

Article::withAnyTag(['Gardening','Cooking'])->get(); // fetch articles with any tag listed

Article::withAllTags(['Gardening', 'Cooking'])->get(); // only fetch articles with all the tags

Conner\Tagging\Model\Tag::where('count', '>', 2)->get(); // return all tags used more than twice

Article::existingTags(); // return collection of all existing tags on any articles
```

[More examples in the documentation](docs/usage-examples.md)

### Configure

[](#configure)

[See config/tagging.php](config/tagging.php) for configuration options.

### Further Documentation

[](#further-documentation)

[See the docs/ folder](docs) for more documentation.

#### Upgrading Laravel 4 to 5

[](#upgrading-laravel-4-to-5)

This library stores full model class names into the database. When you upgrade laravel and you add namespaces to your models, you will need to update the records stored in the database. Alternatively you can override Model::$morphClass on your model class to match the string stored in the database.

#### Credits

[](#credits)

- Robert Conner -

#### Further Reading

[](#further-reading)

- [Laravel News article on tagging with this library](https://laravel-news.com/2015/10/how-to-add-tagging-to-your-laravel-app/)
- [3rd Party Posting on installation with Twitter Bootstrap 2.3](http://blog.stickyrice.net/archives/2015/laravel-tagging-bootstrap-tags-input-rtconner)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/cd00273de2ff56ad3546c2233b2463796219d8e2a25f152df2a8d141d6677c80?d=identicon)[thaonguyen90](/maintainers/thaonguyen90)

---

Top Contributors

[![thaonguyen90](https://avatars.githubusercontent.com/u/15682278?v=4)](https://github.com/thaonguyen90 "thaonguyen90 (5 commits)")

### Embed Badge

![Health badge](/badges/thaonv-laravel-tagging/health.svg)

```
[![Health](https://phpackages.com/badges/thaonv-laravel-tagging/health.svg)](https://phpackages.com/packages/thaonv-laravel-tagging)
```

###  Alternatives

[gornymedia/laravel-shortcodes

Laravel shortcodes package

2339.5k](/packages/gornymedia-laravel-shortcodes)

PHPackages © 2026

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