lumen-ui / lumen-tw
Tailwind merge port for Laravel
Fund package maintenance!
Fa-BRAIK
Requires
- php: ^8.4
- illuminate/contracts: ^11.0||^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9||^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- pestphp/pest-plugin-type-coverage: ^3.6
- phpstan/extension-installer: ^1.3||^2.0
- phpstan/phpstan-deprecation-rules: ^1.1||^2.0
- phpstan/phpstan-phpunit: ^1.3||^2.0
- spatie/laravel-ray: ^1.35
This package is auto-updated.
Last update: 2025-07-14 02:14:21 UTC
README
A tailwind-merge port for Laravel. Support up to version 4.1 of Tailwind CSS.
Installation
You can install the package via composer:
composer require lumen-ui/lumen-tw
Usage
// Via global function tw_merge('px-2 py-1 bg-red hover:bg-dark-red', 'p-3 bg-[#B91C1C]')
// Via service container app('twMerge')->merge('px-2 py-1 bg-red hover:bg-dark-red', 'p-3 bg-[#B91C1C]');
// Via Facade use Lumen\TwMerge\Facades\TwMerge; TwMerge::merge('px-2 py-1 bg-red hover:bg-dark-red', 'p-3 bg-[#B91C1C]');
{{-- Using Blade Directive --}} <div @twMerge('bg-blue-600 hover:bg-blue-700', 'bg-blue-400')> ... </div>
{{-- Within blade components using attribute bag macro --}} <div {{ $attributes->twMerge('text-center') }}> ... </div>
Supported Laravel Versions
- ☑️ 11.x
- ☑️ 12.x
Supported Tailwind CSS Versions
This package supports Tailwind CSS versions up to 4.1.
- ☑️ 4.1.0
- ☑️ 4.0.0
- ☑️ 3.x (Legacy)
Reference
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Acknowledgements
- This package is a port of the tailwind-merge for Laravel.
- I created this package as a successor to the laravel-tailwind-merge
as it was not maintained anymore and as a result, it doesn't support Tailwindcss 4.x and above.
- Attribute bag macro
twMerge
,twMergeFor
andwithoutTwMergeClasses
along with@twMerge
blade directive are taken from this package.
- Attribute bag macro
Credits
License
The MIT License (MIT). Please see License File for more information.