PHPackages                             lumen-ui/lumen-tw - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. lumen-ui/lumen-tw

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

lumen-ui/lumen-tw
=================

Tailwind merge port for Laravel

v0.3(9mo ago)2439[3 PRs](https://github.com/Fa-BRAIK/lumen-tw/pulls)1MITPHPPHP ^8.3CI passing

Since Jul 13Pushed 4mo agoCompare

[ Source](https://github.com/Fa-BRAIK/lumen-tw)[ Packagist](https://packagist.org/packages/lumen-ui/lumen-tw)[ Docs](https://github.com/lumen/lumen-tw)[ GitHub Sponsors](https://github.com/Fa-BRAIK)[ RSS](/packages/lumen-ui-lumen-tw/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (14)Versions (7)Used By (1)

Lumen-ui Tailwind Merge
=======================

[](#lumen-ui-tailwind-merge)

[![GitHub License](https://camo.githubusercontent.com/b934f2604290334dc904dbf180f97ec5ab8341a5c3a89d059b81d642171fb771/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e75787469667974732f7068702d64746f)](https://github.com/Fa-BRAIK/lumen-tw/blob/main/LICENSE.md)[![PHP](https://camo.githubusercontent.com/cb58785d47ce17cf0216755e10ce419960162818f8dc7de90dd1e437376b62c5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d2532333737374242342e7376673f266c6f676f3d706870266c6f676f436f6c6f723d7768697465266c6162656c3d382e33)](https://www.php.net/releases/8.3/en.php)[![PhpStan Level](https://camo.githubusercontent.com/d18b9a987aa81e64470a11caecf72caa66597c9ebd6b307bd1c2cb7a752b0dff/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c25323031302d627269676874677265656e2e737667)](https://phpstan.org/user-guide/rule-levels)[![Latest Version on Packagist](https://camo.githubusercontent.com/0b5fdc1a448769edc7514ddb0f263cde16f63c415f8b5e7de37dcad48f99fe6a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c756d656e2d75692f6c756d656e2d74772e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lumen-ui/lumen-tw)[![run-tests](https://github.com/Fa-BRAIK/lumen-tw/actions/workflows/run-tests.yml/badge.svg)](https://github.com/Fa-BRAIK/lumen-tw/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/7be38b26d210dbab0a054c0e22615226d9326efef6f842ee38db7410b5767141/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c756d656e2d75692f6c756d656e2d74772e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lumen-ui/lumen-tw)

A [tailwind-merge](https://github.com/dcastil/tailwind-merge) port for Laravel. Support up to version 4.1 of Tailwind CSS.

   ![LumenTw example](https://github.com/Fa-BRAIK/lumen-tw/raw/main/art/light%3Ahow-to-use.png)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require lumen-ui/lumen-tw
```

Usage
-----

[](#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 --}}

    ...

```

```
{{-- Within blade components using attribute bag macro --}}
twMerge('text-center') }}>
    ...

```

Supported Laravel Versions
--------------------------

[](#supported-laravel-versions)

- ☑️ 11.x
- ☑️ 12.x

Supported Tailwind CSS Versions
-------------------------------

[](#supported-tailwind-css-versions)

This package supports Tailwind CSS versions up to 4.1.

- ☑️ 4.1.0
- ☑️ 4.0.0
- ☑️ 3.x (Legacy)

Reference
---------

[](#reference)

- [Configuration](https://github.com/Fa-BRAIK/lumen-tw/tree/main/docs/configuration.md)
- [Usage Within Blade](https://github.com/Fa-BRAIK/lumen-tw/tree/main/docs/usage-within-blade.md)
- [CssClassBuilder](https://github.com/Fa-BRAIK/lumen-tw/tree/main/docs/css-class-builder.md)
- [Api Reference](https://github.com/Fa-BRAIK/lumen-tw/tree/main/docs/api-reference.md)

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Acknowledgements
----------------

[](#acknowledgements)

- This package is a port of the [tailwind-merge](https://github.com/dcastil/tailwind-merge) for Laravel.
- I created this package as a successor to the [laravel-tailwind-merge](https://github.com/gehrisandro/tailwind-merge-laravel)as it was not maintained anymore and as a result, it doesn't support Tailwindcss 4.x and above.
    - Attribute bag macro `twMerge`, `twMergeFor` and `withoutTwMergeClasses` along with `@twMerge` blade directive are taken from this package.

Credits
-------

[](#credits)

- [Fa-BRAIK](https://github.com/Fa-BRAIK)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

38

—

LowBetter than 84% of packages

Maintenance72

Regular maintenance activity

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~6 days

Total

3

Last Release

287d ago

PHP version history (2 changes)v0.1PHP ^8.4

v0.3PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/d23abe4e557ab602950aeaf2513d2622b72d8d5b080f851338038387caf33c9a?d=identicon)[Fa-BRAIK](/maintainers/Fa-BRAIK)

---

Top Contributors

[![Fa-BRAIK](https://avatars.githubusercontent.com/u/36890379?v=4)](https://github.com/Fa-BRAIK "Fa-BRAIK (71 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")

---

Tags

laravel-packagelaravel-tailwindcsstailwindcss-mergetailwindcss-v4laravellumentailwind-mergelumen-twTailwind merge PHP

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/lumen-ui-lumen-tw/health.svg)

```
[![Health](https://phpackages.com/badges/lumen-ui-lumen-tw/health.svg)](https://phpackages.com/packages/lumen-ui-lumen-tw)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M626](/packages/spatie-laravel-data)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
