laravel-tags
Laravel Tags is a PHP package that adds tagging functionality to Laravel applications. It allows you to attach multiple tags to Eloquent models with support for tag types, translations, and sorting.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | spatie/laravel-tags |
| Owner | spatie |
| Primary language | PHP |
| License | MIT — OSI-approved |
| Stars | 1.7k |
| Forks | 285 |
| Open issues | 0 |
| Latest release | 4.12.0 (2026-06-20) |
| Last updated | 2026-06-26 |
| Source | https://github.com/spatie/laravel-tags |
What laravel-tags is
A Laravel/Eloquent trait-based package providing many-to-many tagging via a pivot table. Includes query builders for filtering by tags, slug generation, tag type segregation, multi-language support via translation attributes, and order manipulation.
Get the laravel-tags source
Clone the repository and explore it locally.
git clone https://github.com/spatie/laravel-tags.gitcd laravel-tags# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Add HasTags trait to target Eloquent model; run published migrations to create tags and taggables pivot tables.
- Configure the optional config file to customize slug generation; defaults to Laravel's Str::slug helper.
- Test tag queries (withAnyTags, withAllTags, withoutTags) against your data volume to ensure acceptable query performance.
- Plan multi-language support upfront using setTranslation and tagsTranslated() methods if content is multilingual.
- Document tag type naming conventions within your team to avoid accidental collisions across feature areas.
When to avoid it — and what to weigh
- Hierarchical/Tree Taxonomies — This package handles flat tags only. If you need parent-child relationships, categories with levels, or tree structures, choose a different solution.
- Non-Laravel or Legacy Frameworks — Requires Laravel 8+ and PHP 8+. Not compatible with older versions or non-Laravel applications.
- Non-JSON-capable Databases — The package requires databases with JSON field support and MySQL-compatible functions. Legacy databases without JSON may not work.
- High-volume Tag Performance Optimization — No mention of query optimization, caching strategies, or performance tuning for millions of tags or complex filtering at scale.
License & commercial use
MIT License permits commercial use, modification, and distribution with minimal restrictions. Full legal permissiveness under OSI-approved MIT terms.
MIT is a permissive OSI-approved license allowing unrestricted commercial use, including closed-source derivatives. No license fees or attribution requirement (though the package authors request a postcard if used in production). Suitable for proprietary Laravel applications.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Strong |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Strong |
| Assessment confidence | High |
No known vulnerabilities reported (zero open issues). Dedicated security contact ([email protected]) available for disclosures. Standard practices: validate tag input server-side, ensure database credentials are protected, and review any custom slug generation logic. No penetration test data or security audit results provided in public data.
Alternatives to consider
Cviebrock/eloquent-taggable
Alternative Laravel tagging package; consider if you need different API, maintenance profile, or specific feature set not in laravel-tags.
Waavi/serializable
Lightweight serialization for Eloquent; may suffice for simple tag-like metadata without a dedicated tagging package.
Custom many-to-many pivot table
Build your own tagging via Laravel's hasMany/belongsToMany if you need full control and minimal dependencies.
Build on laravel-tags with DEV.co software developers
Evaluate laravel-tags for content categorization, search filtering, and multilingual tagging. If you need hierarchical taxonomies or non-Laravel frameworks, explore alternatives first.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
laravel-tags FAQ
Can I use this with non-Laravel PHP applications?
Do tags support hierarchies or parent-child relationships?
Is translation support automatic or must I manually set translations?
What performance considerations exist for large datasets?
Software developers & web developers for hire
DEV.co helps companies turn open-source tools like laravel-tags into production software. Our software development services cover the full lifecycle — architecture, web development, integration, and maintenance — delivered by software developers and web developers who ship. Engage our software development agency to implement or customize it for your open-source databases stack.
Ready to Add Tagging to Your Laravel App?
Evaluate laravel-tags for content categorization, search filtering, and multilingual tagging. If you need hierarchical taxonomies or non-Laravel frameworks, explore alternatives first.