PHPackages                             goodm4ven/tailwind-merge - 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. [Templating &amp; Views](/categories/templating)
4. /
5. goodm4ven/tailwind-merge

ActiveLibrary[Templating &amp; Views](/categories/templating)

goodm4ven/tailwind-merge
========================

Resolves TailwindCSS class conflicts in between Laravel Blade component calls

v1.1.10(2mo ago)2758↓40%1[5 PRs](https://github.com/GoodM4ven/PACKAGE_LARAVEL_tailwind-merge/pulls)2MITPHPPHP ^8.4||^8.3CI passing

Since Dec 23Pushed 1mo agoCompare

[ Source](https://github.com/GoodM4ven/PACKAGE_LARAVEL_tailwind-merge)[ Packagist](https://packagist.org/packages/goodm4ven/tailwind-merge)[ Docs](https://github.com/goodm4ven/PACKAGE_LARAVEL_tailwind-merge)[ Fund](https://www.buymeacoffee.com/GoodM4ven)[ GitHub Sponsors](https://github.com/GoodM4ven)[ RSS](/packages/goodm4ven-tailwind-merge/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (17)Versions (18)Used By (2)

بسم الله الرحمن الرحيم

Tailwind Merge
==============

[](#tailwind-merge)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9a52894ea53618fbf5c7496e309607df2f63e84f06cd911047dd3748624f3706/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f676f6f646d3476656e2f7461696c77696e642d6d657267652e7376673f7374796c653d666f722d7468652d626164676526636f6c6f723d67726179)](https://packagist.org/packages/goodm4ven/tailwind-merge)[![GitHub Tests Action Status](https://camo.githubusercontent.com/76b43dfa7b8b8fce9775ffb3a35723487dead6c8341b0ed8eff0794f5030b793/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f676f6f646d3476656e2f5041434b4147455f4c41524156454c5f7461696c77696e642d6d657267652f706573742e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666f722d7468652d626164676526636f6c6f723d666f72657374677265656e)](https://github.com/goodm4ven/PACKAGE_LARAVEL_tailwind-merge/actions?query=workflow%3Apest+branch%3Amain)[![Coverage Status](https://camo.githubusercontent.com/82c00eb3c072eec67fa3706e2d116880c758d861c4ee0d9f3991c2029552889f/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f676f6f646d3476656e2f5041434b4147455f4c41524156454c5f7461696c77696e642d6d657267652f6d61696e3f7374796c653d666f722d7468652d626164676526636f6c6f723d707572706c65)](https://codecov.io/gh/goodm4ven/PACKAGE_LARAVEL_tailwind-merge)[![Total Downloads](https://camo.githubusercontent.com/a772890a5fe1cfaa37e8a2dbd2af102ed7e317f8ed86a89b23e4c516e9508758/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f676f6f646d3476656e2f7461696c77696e642d6d657267652e7376673f7374796c653d666f722d7468652d626164676526636f6c6f723d626c7565)](https://packagist.org/packages/goodm4ven/tailwind-merge)

[![](./.github/images/banner.png)](./.github/images/banner.png)Dealing with TailwindCSS classes overriding can either be done with fighting important (`!`) classes, **OR** by using this package to remove the conflicting ones from the targetted component and keep the outside (passed) one instead.

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

[](#installation)

Install the package with [`Composer`](https://getcomposer.org/):

```
composer require goodm4ven/tailwind-merge
```

Usage
-----

[](#usage)

**It's all about the last-wins approach for consistency. Single string or multiple ones are around as arguments. You may also add them as an associative array to conditions!**

- Global helper function for PHP anywhere

```
twMerge('text-lg text-sm'); // results in "text-sm"
twMerge('sm:text-lg', 'sm:text-3xl'); // results in "sm:text-3xl"
twMerge([
    'sm:text-lg py-10 px-5' => true,
    'sm:text-xl' => false,
    'sm:text-3xl py-5',
    'sm:text-sm' => true,
]); // results in "sm:text-sm px-5 py-5"
```

- Resolve the merger directly (container or facade)

```
// Either
app('tailwind-merge')->classes('last conflicting classes win');
// Or
\GoodMaven\TailwindMerge\TailwindMerge::classes('last conflicting classes win');
```

- Attribute bag macro inside Laravel Blade components

```
$attributes->twMerge('last conflicting classes win', 'then last conflicting classes win');
```

- Blade directive for Blade views in general

```
@twMerge('last conflicting classes win')
```

Development
-----------

[](#development)

This package was initiated based on my [Laravel package template](https://github.com/goodm4ven/TEMPLATE_PACKAGE_TALL/blob/main/README.md#development) that is built on top of [Spatie's](https://github.com/spatie/package-skeleton-laravel). Make sure to read the docs for both.

Support
-------

[](#support)

Support ongoing package maintenance as well as the development of **other projects** through [sponsorship](https://github.com/sponsors/GoodM4ven) or one-time [donations](https://github.com/sponsors/GoodM4ven?frequency=one-time&sponsor=GoodM4ven) if you prefer.

### Credits

[](#credits)

- Inspired by the [original package](https://github.com/gehrisandro/tailwind-merge-laravel)
- [Blade Formatter](https://github.com/shufo/blade-formatter)
- [Pest](https://github.com/pestphp/pest-plugin-laravel)
- [Playwrite](https://playwrite.dev)
- [PHP](https://php.net)
- [TailwindCSS](https://tailwindcss.com)
- [Laravel](https://laravel.com)
- [ChatGPT &amp; Codex](https://developers.openai.com/codex)
- [GoodM4ven](https://github.com/GoodM4ven)
- [All Contributors](../../contributors)

والحمد لله رب العالمين

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance87

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 91.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

11

Last Release

89d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2fe03bedf65c411e3623e9c103eb2dc4626c5d4ee3fab62cfb98d88caab82a4b?d=identicon)[GoodM4ven](/maintainers/GoodM4ven)

---

Top Contributors

[![GoodM4ven](https://avatars.githubusercontent.com/u/121377476?v=4)](https://github.com/GoodM4ven "GoodM4ven (34 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")

---

Tags

bladeconflictlaravelmergeoverridetailwindcsstallstacklaravelconflictoverridetailwindcsstallstackGoodM4ventailwind-merge

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/goodm4ven-tailwind-merge/health.svg)

```
[![Health](https://phpackages.com/badges/goodm4ven-tailwind-merge/health.svg)](https://phpackages.com/packages/goodm4ven-tailwind-merge)
```

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[robsontenorio/mary

Gorgeous UI components for Livewire powered by daisyUI and Tailwind

1.5k454.7k15](/packages/robsontenorio-mary)[moonshine/moonshine

Laravel administration panel

1.3k217.1k59](/packages/moonshine-moonshine)[ryangjchandler/blade-capture-directive

Create inline partials in your Blade templates with ease.

8222.2M12](/packages/ryangjchandler-blade-capture-directive)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[spatie/laravel-blade-comments

Add debug comments to your rendered output

177325.5k](/packages/spatie-laravel-blade-comments)

PHPackages © 2026

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