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

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

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

Use PHP traits to extend Laravel Eloquent Models to allow Tags. Models can be marked as Taggable.

06PHPCI failing

Since Nov 8Pushed 6y ago1 watchersCompare

[ Source](https://github.com/softtechnoes/rtconner-laravel-tagging-modified-)[ Packagist](https://packagist.org/packages/tagging/laravel-tagging)[ RSS](/packages/tagging-laravel-tagging/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)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)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6efcfb2934952fa279d7ad90e04f9a6f477c761efd5f0e7add1650fc4e4df65e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7274636f6e6e65722f6c61726176656c2d74616767696e672f6261646765732f7175616c6974792d73636f72652e706e673f623d6c61726176656c2d35)](https://scrutinizer-ci.com/g/rtconner/laravel-tagging/?branch=laravel-5)

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/Lumen 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+/Lumen 5)

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

```
composer require rtconner/laravel-tagging "~3.2"
```

#### Install and then Run the migrations

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

The package should auto-discover when you composer update. Then publish the tagging.php and run the database migrations with these commands.

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

#### 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

Article::withoutTags(['Gardening', 'Cooking'])->get(); // only fetch articles without all tags listed

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
```

[Documentation: More Usage Examples](docs/usage-examples.md)

[Documentation: Tag Groups](docs/tag-groups.md)

[Documentation: Tagging Events](docs/events.md)

[Documentation: Tag Suggesting](docs/suggesting.md)

### Configure

[](#configure)

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

###### Lumen Installation

[](#lumen-installation)

[Documentation: Lumen](docs/lumen.md)

#### 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/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

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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/95523d5a254e557b55e70092b3b5121c0d00b9037b37c317ab7e15145042d925?d=identicon)[softtechnoes](/maintainers/softtechnoes)

---

Top Contributors

[![softtechnoes](https://avatars.githubusercontent.com/u/37590945?v=4)](https://github.com/softtechnoes "softtechnoes (7 commits)")

### Embed Badge

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

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

###  Alternatives

[aiz-packages/color-code-converter

HEX code coverted to RGB color code

1419.5k](/packages/aiz-packages-color-code-converter)[boomcms/boom-core

Core classes for BoomCMS

193.0k6](/packages/boomcms-boom-core)

PHPackages © 2026

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