Laravel-Tagging vs Laravel-Tags: A Tagging Package Comparison

Featurelaravel-tagginglaravel-tags
InstallationRequires composer require rtconner/laravel-taggingRequires composer require spatie/laravel-tags
NamespaceConner\TaggingSpatie\Tags
Trait for ModelsTaggableHasTags
Adding Tags$model->tag('tag1, tag2, tag3');$model->attachTags(['tag1', 'tag2']);
Retrieving Models by Tag$models = YourModel::withAnyTag(['tag1', 'tag2'])->get();$models = YourModel::withAllTags(['tag1', 'tag2'])->get();
Removing Tags$model->untag('tag1');$model->detachTags(['tag1']);
Getting Tags for a Model$tags = $model->tags;$tags = $model->tags;
Tag Counts$tagCounts = YourModel::existingTags()->get();$tagCounts = YourModel::getTags()->pluck('name', 'count');
Custom Tag ModelsNot supported$model->attachTags(['tag1', 'tag2'], ['type' => 'custom']);
Sorting Tags by CountNot directly supported$tags = YourModel::tagsWithType('type')->get()->sortByDesc('count');
Customizing Tagging Configurationconfig/tagging.phpConfiguration in config/tags.php
Soft Deletes SupportNot directly supportedSupports soft deletes through SoftDeletes trait
Custom Tagging ModelNot directly supportedSupports custom tagging model
Laravel Version CompatibilitySupports Laravel 5.x, 6.xSupports Laravel 7.x, 8.x
Package DocumentationLimited documentation availableExtensive documentation available

In conclusion, the choice between laravel-tagging and laravel-tags depends on your specific project requirements and preferences. Each package has its strengths, so carefully consider the features that matter most to you. Always refer to the official documentation for the most up-to-date information.


Posted

in

by

Tags: