PHPackages                             emresari89/laravel-tags - 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. [Database &amp; ORM](/categories/database)
4. /
5. emresari89/laravel-tags

ActiveLibrary[Database &amp; ORM](/categories/database)

emresari89/laravel-tags
=======================

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

v1.0.1(4y ago)096MITPHPPHP ^7.3|^8.0

Since Mar 18Pushed 4y ago1 watchersCompare

[ Source](https://github.com/emresari89/laravel-tags)[ Packagist](https://packagist.org/packages/emresari89/laravel-tags)[ Docs](https://smartersoftware.net/packages/laravel-tagging-taggable)[ RSS](/packages/emresari89-laravel-tags/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (6)Versions (3)Used By (0)

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

[](#laravel-taggable-trait)

[![Latest Stable Version](https://camo.githubusercontent.com/dc2a7083523739451f381c09f0779cb8371815d382ceb03dd63212e4a279f2cc/68747470733a2f2f706f7365722e707567782e6f72672f656d72657361726938392f6c61726176656c2d746167732f762f737461626c652e737667)](https://packagist.org/packages/emresari89/laravel-tags)[![Total Downloads](https://camo.githubusercontent.com/74200d879b34cd4215f72e5de2c997c73f05d2313c7c65a662b8efe6c9b9e83e/68747470733a2f2f706f7365722e707567782e6f72672f656d72657361726938392f6c61726176656c2d746167732f646f776e6c6f6164732e737667)](https://packagist.org/packages/emresari89/laravel-tags)[![License](https://camo.githubusercontent.com/df03966c7269f6ff874d312ebb80b002c17d3d1b1b61d76bfb6bd1e1dfe5fc7d/68747470733a2f2f706f7365722e707567782e6f72672f656d72657361726938392f6c61726176656c2d746167732f6c6963656e73652e737667)](https://packagist.org/packages/emresari89/laravel-tags)[![Build Status](https://camo.githubusercontent.com/2847dfe60ae573f16a5c5ae18a67415c1ca5e11e0b3acd5fd6b1ae78242601fb/68747470733a2f2f7472617669732d63692e6f72672f656d72657361726938392f6c61726176656c2d746167732e7376673f6272616e63683d6c61726176656c2d38)](https://travis-ci.org/emresari89/laravel-tags)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/42b04c1dce1145978d66eafdf41716c40599d5e1a78e130fb782ef7012589193/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f656d72657361726938392f6c61726176656c2d746167732f6261646765732f7175616c6974792d73636f72652e706e673f623d6c61726176656c2d38)](https://scrutinizer-ci.com/g/emresari89/laravel-tags/?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 emresari89/laravel-tags
```

#### 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="Emresari\Tagging\Providers\TaggingServiceProvider"
php artisan migrate
```

#### Setup your models

[](#setup-your-models)

```
class Article extends \Illuminate\Database\Eloquent\Model
{
	use \Emresari\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

Emresari\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)

- Emre Sarıoğlu -

#### 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-tags-bootstrap-tags-input-emresari89)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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.

###  Release Activity

Cadence

Every ~56 days

Total

2

Last Release

1824d ago

PHP version history (2 changes)v1.0.0PHP ^7.3

v1.0.1PHP ^7.3|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/625d948dfdb74217ac59c79830305425a519a42438be12b854f17930664313f1?d=identicon)[emresari89](/maintainers/emresari89)

---

Top Contributors

[![emresari89](https://avatars.githubusercontent.com/u/29493496?v=4)](https://github.com/emresari89 "emresari89 (3 commits)")

---

Tags

laraveleloquenttagstagtaggingtaggedTaggable

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[rtconner/laravel-tagging

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

8833.1M14](/packages/rtconner-laravel-tagging)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[toponepercent/baum

Baum is an implementation of the Nested Set pattern for Eloquent models.

3154.7k](/packages/toponepercent-baum)

PHPackages © 2026

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