PHPackages                             martinpl/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. martinpl/tailwind-merge

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

martinpl/tailwind-merge
=======================

PHP port of tailwind-merge: merge Tailwind CSS class strings by removing style conflicts

08↓93.3%TypeScript

Since Apr 4Pushed 3mo agoCompare

[ Source](https://github.com/martinpl/tailwind-merge)[ Packagist](https://packagist.org/packages/martinpl/tailwind-merge)[ RSS](/packages/martinpl-tailwind-merge/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

 [ ![tailwind-merge](https://github.com/dcastil/tailwind-merge/raw/v3.5.0/assets/logo.svg) ](https://github.com/dcastil/tailwind-merge)

tailwind-merge
==============

[](#tailwind-merge)

Utility function to efficiently merge [Tailwind CSS](https://tailwindcss.com) classes in JS without style conflicts.

```
import { twMerge } from 'tailwind-merge'

twMerge('px-2 py-1 bg-red hover:bg-dark-red', 'p-3 bg-[#B91C1C]')
// → 'hover:bg-dark-red p-3 bg-[#B91C1C]'
```

- Supports Tailwind v4.0 up to v4.2 (if you use Tailwind v3, use [tailwind-merge v2.6.0](https://github.com/dcastil/tailwind-merge/tree/v2.6.0))
- Works in all modern browsers and maintained Node versions
- Fully typed
- [Check bundle size on Bundlephobia](https://bundlephobia.com/package/tailwind-merge)

Get started
-----------

[](#get-started)

- [What is it for](https://github.com/dcastil/tailwind-merge/tree/v3.5.0/docs/what-is-it-for.md)
- [When and how to use it](https://github.com/dcastil/tailwind-merge/tree/v3.5.0/docs/when-and-how-to-use-it.md)
- [Features](https://github.com/dcastil/tailwind-merge/tree/v3.5.0/docs/features.md)
- [Limitations](https://github.com/dcastil/tailwind-merge/tree/v3.5.0/docs/limitations.md)
- [Configuration](https://github.com/dcastil/tailwind-merge/tree/v3.5.0/docs/configuration.md)
- [Recipes](https://github.com/dcastil/tailwind-merge/tree/v3.5.0/docs/recipes.md)
- [API reference](https://github.com/dcastil/tailwind-merge/tree/v3.5.0/docs/api-reference.md)
- [Writing plugins](https://github.com/dcastil/tailwind-merge/tree/v3.5.0/docs/writing-plugins.md)
- [Versioning](https://github.com/dcastil/tailwind-merge/tree/v3.5.0/docs/versioning.md)
- [Contributing](https://github.com/dcastil/tailwind-merge/tree/v3.5.0/docs/contributing.md)
- [Similar packages](https://github.com/dcastil/tailwind-merge/tree/v3.5.0/docs/similar-packages.md)

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance55

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/a30d5a48fd47490e6c2e90a852ec813bef85b9cc3b5c7b6cb90747c6e1563dcf?d=identicon)[MartinPLR](/maintainers/MartinPLR)

---

Top Contributors

[![dcastil](https://avatars.githubusercontent.com/u/31006608?v=4)](https://github.com/dcastil "dcastil (1283 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (98 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (43 commits)")[![quantizor](https://avatars.githubusercontent.com/u/570070?v=4)](https://github.com/quantizor "quantizor (20 commits)")[![XantreDev](https://avatars.githubusercontent.com/u/57757211?v=4)](https://github.com/XantreDev "XantreDev (13 commits)")[![martinpl](https://avatars.githubusercontent.com/u/8329810?v=4)](https://github.com/martinpl "martinpl (7 commits)")[![kachkaev](https://avatars.githubusercontent.com/u/608862?v=4)](https://github.com/kachkaev "kachkaev (3 commits)")[![jmmarco](https://avatars.githubusercontent.com/u/3438337?v=4)](https://github.com/jmmarco "jmmarco (2 commits)")[![akshitatechuweb](https://avatars.githubusercontent.com/u/246623641?v=4)](https://github.com/akshitatechuweb "akshitatechuweb (2 commits)")[![maurer2](https://avatars.githubusercontent.com/u/6861911?v=4)](https://github.com/maurer2 "maurer2 (2 commits)")[![sherlockdoyle](https://avatars.githubusercontent.com/u/17477263?v=4)](https://github.com/sherlockdoyle "sherlockdoyle (2 commits)")[![KeKs0r](https://avatars.githubusercontent.com/u/2970814?v=4)](https://github.com/KeKs0r "KeKs0r (2 commits)")[![kidonng](https://avatars.githubusercontent.com/u/44045911?v=4)](https://github.com/kidonng "kidonng (2 commits)")[![LarsArtmann](https://avatars.githubusercontent.com/u/23587853?v=4)](https://github.com/LarsArtmann "LarsArtmann (2 commits)")[![CrutchTheClutch](https://avatars.githubusercontent.com/u/22361526?v=4)](https://github.com/CrutchTheClutch "CrutchTheClutch (2 commits)")[![LesnoyPudge](https://avatars.githubusercontent.com/u/79414771?v=4)](https://github.com/LesnoyPudge "LesnoyPudge (2 commits)")[![scott-lc](https://avatars.githubusercontent.com/u/70149099?v=4)](https://github.com/scott-lc "scott-lc (1 commits)")[![stephan281094](https://avatars.githubusercontent.com/u/4006802?v=4)](https://github.com/stephan281094 "stephan281094 (1 commits)")[![szamanr](https://avatars.githubusercontent.com/u/2622838?v=4)](https://github.com/szamanr "szamanr (1 commits)")[![VIKTORVAV99](https://avatars.githubusercontent.com/u/30777521?v=4)](https://github.com/VIKTORVAV99 "VIKTORVAV99 (1 commits)")

### Embed Badge

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

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

###  Alternatives

[phpseclib/bcmath_compat

PHP 5.x-8.x polyfill for bcmath extension

16821.5M26](/packages/phpseclib-bcmath-compat)[wikimedia/aho-corasick

An implementation of the Aho-Corasick string matching algorithm.

584.0M7](/packages/wikimedia-aho-corasick)[jfcherng/php-mb-string

A high performance multibytes sting implementation for frequently reading/writing operations.

145.8M3](/packages/jfcherng-php-mb-string)

PHPackages © 2026

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