Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Tags Laravel Package

suppercup/laravel-tags

A Laravel tagging package from Suppercup that helps attach, manage, and query tags on Eloquent models. It offers a simple way to categorize content and build tag-based filters, making it useful for blogs, CMSs, and other apps that need flexible tagging.

View on GitHub
Deep Wiki
Context7

Getting Started

This is the Rinvex Taggable package published under the suppercup/laravel-tags name. Treat the package identity carefully: the linked repository is rinvex/laravel-tags, the project is archived, has very low adoption, and shows zero dependents. Before installing, confirm the actual Composer package name and inspect vendor/suppercup/laravel-tags or vendor/rinvex/laravel-tags for the real namespace and API.

Minimal setup:

composer require suppercup/laravel-tags

# Publish what the package exposes. Rinvex packages commonly use tags
# such as "rinvex-tags-migrations" and "rinvex-tags-config".
php artisan vendor:publish

php artisan migrate

Then add the trait to any Eloquent model you want to tag:

use Illuminate\Database\Eloquent\Model;
use Rinvex\Tags\Traits\Taggable;

class Post extends Model
{
    use Taggable;
}

First use case:

$post = Post::create([
    'title' => 'Hello world',
]);

$post->attachTags(['laravel', 'php']);

$post->tags; // collection of Tag models

The first places to look are:

  • The published config/tags.php, especially model and table mappings.
  • The package migration for the tags and taggables tables.
  • Rinvex\Tags\Models\Tag and Rinvex\Tags\Traits\Taggable in the vendor directory.
  • The published README or source tests, because the package is archived and community examples are sparse.

For a greenfield project, I would not choose this package. Use spatie/laravel-tags or a small custom polymorphic pivot unless you are specifically maintaining an existing Rinvex-based codebase.

Implementation Patterns

Treat tags as a normalized set on write. The most reliable day-to-day pattern is to normalize user input once and then call the package’s sync-style method so duplicate submissions do not create a mess:

$tags = collect($request->input('tags', []))
    ->map(fn ($tag) => trim((string) $tag))
    ->filter()
    ->unique(fn ($tag) => mb_strtolower($tag))
    ->values()
    ->all();

$post->syncTags($tags);

Use attachTags() for additive workflows and syncTags() when the submitted form represents the complete canonical set. Be deliberate about which one you choose; accidental syncTags() calls will silently remove tags.

Create and manage tags through the Tag model. For tag administration screens, use the package’s configured model rather than hard-coding Rinvex\Tags\Models\Tag everywhere. If the config allows model overrides, resolve it through config so a fork or extension does not break.

$tag = Tag::create([
    'name' => 'Laravel',
    'description' => 'PHP framework',
]);

Because the package advertises Sluggable and Translatable support, tag names and descriptions may be locale-aware. When building admin screens, explicitly decide whether editors manage one canonical name or per-locale translations. Use the slug for stable URLs and lookups where possible.

Use query scopes for filtering listings. The package exposes tag-aware query scopes; combine them with your normal constraints and eager loading:

$posts = Post::query()
    ->with('tags')
    ->withAllTags(['laravel', 'php'])
    ->where('published', true)
    ->latest()
    ->paginate();

Always eager load tags when rendering a list. Otherwise every row that displays its tags will trigger an additional query.

Integrate tags at the action/service layer. Keep tag attachment out of controllers when possible. A CreatePost action or model observer can attach tags after the model is persisted, keeping transaction boundaries clear:

DB::transaction(function () use ($data) {
    $post = Post::create($data);

    $post->attachTags($data['tags'] ?? []);

    return $post;
});

Handle deletion explicitly. The polymorphic taggables pivot may not cascade when a tagged model is deleted. Add a model event or database-level cascade so orphaned pivot rows do not accumulate:

static::deleting(function (Post $post) {
    $post->tags()->detach();
});

Use tags as a lightweight taxonomy, not as a full category system. For day-to-day use, tags work best for cross-cutting labels, search filters, and related-content blocks. If you need hierarchy, permissions, ordering, or rich metadata per assignment, the pivot will need custom columns and the package’s basic API will become limiting.

Gotchas and Tips

The archive status is the biggest risk. This package is unmaintained and has effectively no ecosystem. Check compatibility before committing:

composer why-not suppercup/laravel-tags
composer show suppercup/laravel-tags

If you are on Laravel 10/11 or PHP 8.2+, expect dependency conflicts with its Sluggable/Translatable dependencies. Pin versions, fork the package, or budget time to replace it.

Verify the package and namespace actually match. The repository is Rinvex, but the package name is suppercup/laravel-tags. Forks often lag, rename namespaces, or change publish tags. If Rinvex\Tags\Traits\Taggable does not exist, inspect the vendor source before writing application code.

Publish tags are easy to get wrong. If vendor:publish --tag="rinvex-tags-migrations" does nothing, run plain php artisan vendor:publish and inspect the listed provider/tag groups. Also confirm the migration ran; a missing taggables table produces confusing relationship errors later.

Config caching can hide changes. If you override the Tag model, table names, or slug settings, run:

php artisan config:clear

after editing config. In production, remember that config:cache freezes those values.

Translation fallback can surprise you. With Translatable models, $tag->name depends on the current locale and fallback configuration. Querying by translated attributes can behave differently from querying by slug. Use slugs for canonical lookup and test with a non-default locale.

Slug collisions need a policy. Creating “Laravel”, “laravel”, and “Laravel ” may produce duplicate-looking tags or slug conflicts depending on Sluggable configuration. Normalize input aggressively and deduplicate by lowercase name before creation.

Morph maps must stay consistent. If you use Relation::enforceMorphMap(), existing taggable_type values must match the morph aliases. Changing morph maps after data exists can break tag lookups and scopes.

Watch query performance on large tag sets. withAllTags and withAnyTag style scopes often compile to subqueries or joins. Index taggables.tag_id, taggables.taggable_type, and taggables.taggable_id, and inspect EXPLAIN once your dataset grows.

syncTags() is destructive by design. It is convenient for forms but dangerous in background jobs or partial updates. Prefer attachTags()/detachTags() when you only know part of the intended tag set.

Debug through the source. With 29 stars and zero dependents, there is little community troubleshooting. Use Laravel’s query log, inspect the trait methods directly, and read the package tests if present. Keep your integration thin so replacing the package later is a contained change rather than a rewrite.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib