gehrisandro/tailwind-merge-laravel
Merge Tailwind CSS classes in Laravel and automatically resolve conflicts (later classes win). Ideal for Blade components and directives. PHP/Laravel port of tailwind-merge. Supports Tailwind v3.0–v3.3 (Laravel 10+).
Adopt when:
Look elsewhere if:
classGroups config manually)."This package solves a critical pain point in our Laravel + Tailwind workflow: class conflicts in reusable UI components. By automating conflict resolution, we can:
"This Laravel package integrates tailwind-merge into Blade components, offering:
bg-red-500 bg-blue-500 → bg-blue-500.@twMerge) and component attributes ($attributes->twMerge()) for flexible usage.composer require and integrate into Blade components. No frontend changes needed.""This tool bridges the gap between design consistency and developer efficiency by:
rounded-lg shadow-md hover:shadow-lg, so you don’t have to manually test every combination.<!-- Component -->
<button {{ $attributes->twMerge('px-4 py-2 bg-blue-500') }}>
Click Me
</button>
<!-- Usage -->
<x-button class="bg-green-500 hover:bg-green-600"> <!-- Merges to: px-4 py-2 bg-green-500 hover:bg-green-600 -->
No more ‘works on my machine’ CSS issues!"
How can I help you explore Laravel packages today?