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

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

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

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

0300PHP

Since Apr 9Pushed 5y ago1 watchersCompare

[ Source](https://github.com/idevin/laravel-tagging)[ Packagist](https://packagist.org/packages/idevin/laravel-tagging)[ RSS](/packages/idevin-laravel-tagging/feed)WikiDiscussions master Synced today

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/75aa1b00808a32ab0f661de2e8c41267acef276b67dd432e0a26dd86c2552501/68747470733a2f2f7472617669732d63692e6f72672f7274636f6e6e65722f6c61726176656c2d74616767696e672e7376673f6272616e63683d6c61726176656c2d38)](https://travis-ci.org/rtconner/laravel-tagging)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/d278809d506f7bd8673c283060705d9d9b149237f0379dca7df9f66b43eb5764/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7274636f6e6e65722f6c61726176656c2d74616767696e672f6261646765732f7175616c6974792d73636f72652e706e673f623d6c61726176656c2d38)](https://scrutinizer-ci.com/g/rtconner/laravel-tagging/?branch=laravel-8)

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()

```
composer require rtconner/laravel-tagging
```

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

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

Popularity11

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

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/bda4d578e23319f50a57fabc75dad17c563f1601294c928467a0a01ca9848df6?d=identicon)[MindSupport](/maintainers/MindSupport)

### Embed Badge

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

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

###  Alternatives

[dg/composer-cleaner

Victor The Cleaner: removes unnecessary files from vendor directory.

1401.5M29](/packages/dg-composer-cleaner)[paragonie/random-lib

A Library For Generating Secure Random Numbers

703.3M26](/packages/paragonie-random-lib)[kartik-v/bootstrap-tabs-x

Extended Bootstrap Tabs with ability to align tabs in multiple ways, add borders, rotated titles, and more.

1021.3M1](/packages/kartik-v-bootstrap-tabs-x)[undefinedoffset/sortablegridfield

Adds drag and drop functionality to Silverstripe's GridField

941.2M50](/packages/undefinedoffset-sortablegridfield)[log1x/sage-svg

A simple package for using inline SVGs in Sage 10 projects.

121546.7k3](/packages/log1x-sage-svg)[nullpunkt/lz-string-php

PHP Class implementation of LZ-String javascript.

111485.0k20](/packages/nullpunkt-lz-string-php)

PHPackages © 2026

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