PHPackages                             clevel/laravel-tags-mongodb - 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. clevel/laravel-tags-mongodb

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

clevel/laravel-tags-mongodb
===========================

Add tags and taggable behaviour to your Laravel app For MongoDB

v1.0.4(7y ago)42.1k[1 issues](https://github.com/C-Level/laravel-tags-mongodb/issues)MITPHPPHP ^7.2CI failing

Since Apr 9Pushed 7y ago1 watchersCompare

[ Source](https://github.com/C-Level/laravel-tags-mongodb)[ Packagist](https://packagist.org/packages/clevel/laravel-tags-mongodb)[ Docs](https://github.com/clevel/laravel-tags)[ RSS](/packages/clevel-laravel-tags-mongodb/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (5)Dependencies (4)Versions (6)Used By (0)

Add tags and taggable behaviour to a Laravel app
================================================

[](#add-tags-and-taggable-behaviour-to-a-laravel-app)

Here are some code examples:

```
//create a model with some tags
$newsItem = NewsItem::create([
   'name' => 'testModel',
   'tags' => ['tag', 'tag2'], //tags will be created if they don't exist
]);

//attaching tags
$newsItem->attachTag('tag3');
$newsItem->attachTags(['tag4', 'tag5']);

//detaching tags
$newsItem->detachTags('tag3');
$newsItem->detachTags(['tag4', 'tag5']);

//syncing tags
$newsItem->syncTags(['tag1', 'tag2']); // all other tags on this model will be detached

//syncing tags with a type
$newsItem->syncTagsWithType(['tag1', 'tag2'], 'typeA');
$newsItem->syncTagsWithType(['tag1', 'tag2'], 'typeB');

//retrieving tags with a type
$newsItem->tagsWithType('typeA');
$newsItem->tagsWithType('typeB');

//retrieving models that have any of the given tags
NewsItem::withAnyTags(['tag1', 'tag2'])->get();

//retrieve models that have all of the given tags
NewsItem::withAllTags(['tag1', 'tag2'])->get();

//translating a tag
$tag = Tag::findOrCreate('my tag');
$tag->setTranslation('name', 'fr', 'mon tag');
$tag->setTranslation('name', 'nl', 'mijn tag');
$tag->save();

//getting translations
$tag->translate('name'); //returns my name
$tag->translate('name', 'fr'); //returns mon tag (optional locale param)

//convenient translations through taggable models
$newsItem->tagsTranslated();// returns tags with slug_translated and name_translated properties
$newsItem->tagsTranslated('fr');// returns tags with slug_translated and name_translated properties set for specified locale

//using tag types
$tag = Tag::findOrCreate('tag 1', 'my type');

//tags have slugs
$tag = Tag::findOrCreate('yet another tag');
$tag->slug; //returns "yet-another-tag"
```

Requirements
------------

[](#requirements)

This package requires Laravel 5.7 or higher, PHP 7.0 or higher and a database that supports `json` fields and functions such as MySQL 5.7 or higher.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require clevel/laravel-tags
```

The package will automatically register itself.

```
php artisan vendor:publish --provider="Clevel\Tags\TagsServiceProvider" --tag="config"
```

This is the contents of the published config file:

```
return [

    /*
     * The given function generates a URL friendly "slug" from the tag name property before saving it.
     */
    'slugger' => 'str_slug',
];
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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 ~0 days

Total

5

Last Release

2638d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/46748527?v=4)[sormagec](/maintainers/sormagec)[@sormagec](https://github.com/sormagec)

---

Top Contributors

[![sormagec](https://avatars.githubusercontent.com/u/46748527?v=4)](https://github.com/sormagec "sormagec (6 commits)")[![bsormagec](https://avatars.githubusercontent.com/u/965219?v=4)](https://github.com/bsormagec "bsormagec (1 commits)")

---

Tags

laravel-tagsclevel

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17818.7k](/packages/markwalet-nova-modal-response)[crumbls/layup

A visual page builder plugin for Filament 5 — Divi-style grid layouts with extensible widgets.

591.7k1](/packages/crumbls-layup)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.2k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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