PHPackages                             yieldstudio/tailwind-merge-php - 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. yieldstudio/tailwind-merge-php

ActiveLibrary

yieldstudio/tailwind-merge-php
==============================

Merge Tailwind CSS classes without style conflicts

0.0.3(2y ago)4972.8k—2.9%1[2 issues](https://github.com/YieldStudio/tailwind-merge-php/issues)1MITPHPPHP &gt;=8.1

Since Jun 10Pushed 2y ago1 watchersCompare

[ Source](https://github.com/YieldStudio/tailwind-merge-php)[ Packagist](https://packagist.org/packages/yieldstudio/tailwind-merge-php)[ RSS](/packages/yieldstudio-tailwind-merge-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (5)Versions (4)Used By (1)

[![Social Card of Tailwind Merge PHP](./art/socialcard.jpg)](./art/socialcard.jpg)

Efficiently merge Tailwind CSS classes in PHP without style conflicts
=====================================================================

[](#efficiently-merge-tailwind-css-classes-in-php-without-style-conflicts)

[![Latest Version](https://camo.githubusercontent.com/15b5bffae035ff7583bd2841b89ae8f7dfa7163075b0b64ae164658be4e4d070/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7969656c6473747564696f2f7461696c77696e642d6d657267652d7068703f7374796c653d666c61742d737175617265)](https://github.com/yieldstudio/tailwind-merge-php/releases)[![GitHub Workflow Status](https://camo.githubusercontent.com/e153fba87c2aee090cf51ce0ef638e9c01e0e6aa85640ebdf882343f6d399398/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7969656c6473747564696f2f7461696c77696e642d6d657267652d7068702f74657374732e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265)](https://github.com/yieldstudio/tailwind-merge-php/actions/workflows/tests.yml)[![Total Downloads](https://camo.githubusercontent.com/65a597b2454fcbad17b42fd85f5e19ba7fb04e1b402a2e6b78ce7ee4fcab9f7d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7969656c6473747564696f2f7461696c77696e642d6d657267652d7068703f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yieldstudio/tailwind-merge-php)

This package allows you to merge multiple [Tailwind CSS](https://tailwindcss.com) classes and automatically resolves conflicts between them without headaches.

tailwind-merge-php is a PHP port of the excellent [tailwind-merge](https://github.com/dcastil/tailwind-merge) created by [dcastil](https://github.com/dcastil).

- Supports Tailwind v3.0 up to v3.3
- First-class support for [Laravel](https://laravel.com/)

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

[](#installation)

```
composer require yieldstudio/tailwind-merge-php

```

Usage
-----

[](#usage)

```
use YieldStudio\TailwindMerge\TailwindMerge;
use YieldStudio\TailwindMerge\TailwindMergeConfig;

// Singleton
$twMerge = TailwindMerge::instance();
$twMerge->merge('w-8 h-8 rounded-full rounded-lg'); // w-8 h-8 rounded-lg

// Custom instance
$twMerge = new TailwindMerge(TailwindMergeConfig::default()); // Config is optional
$twMerge->merge('w-8 h-8 rounded-full rounded-lg'); // w-8 h-8 rounded-lg
```

Laravel Support
---------------

[](#laravel-support)

You can publish the configuration file with:

```
php artisan vendor:publish --provider="YieldStudio\TailwindMerge\Laravel\TailwindMergeServiceProvider"
```

### Using the `tw` helper

[](#using-the-tw-helper)

```
tw('w-8 h-8 rounded-full rounded-lg'); // w-8 h-8 rounded-lg
```

### Using Blade directive

[](#using-blade-directive)

```

// will be

```

### Using Blade components

[](#using-blade-components)

```
// avatar.blade.php
tw('w-8 h-8 rounded-full') }}>

// header.blade.php

// will be

```

Configuration &amp; plugins
---------------------------

[](#configuration--plugins)

> ✍️ Complete documentation is being written

Unit tests
----------

[](#unit-tests)

To run the tests, just run `composer install` and `composer test`.

Changelog
---------

[](#changelog)

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

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

[](#contributing)

Please see [CONTRIBUTING](https://raw.githubusercontent.com/YieldStudio/.github/main/CONTRIBUTING.md) for details.

### Security

[](#security)

If you've found a bug regarding security please mail  instead of using the issue tracker.

Credits
-------

[](#credits)

- [James Hemery](https://github.com/jameshemery)
- Special thanks to [dcastil](https://github.com/dcastil) who built [tailwind-merge](https://github.com/dcastil/tailwind-merge)

License
-------

[](#license)

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

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community10

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~20 days

Total

3

Last Release

1035d ago

### Community

Maintainers

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

---

Top Contributors

[![JamesHemery](https://avatars.githubusercontent.com/u/23323941?v=4)](https://github.com/JamesHemery "JamesHemery (28 commits)")

---

Tags

classlistconflictcsslaravelmergeoverridephptailwindtailwindcssphplaravelcssconflicttailwindmergeoverridetailwindcssclasslist

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[laravel-frontend-presets/tall

TALL preset for Laravel.

2.6k692.9k1](/packages/laravel-frontend-presets-tall)[gehrisandro/tailwind-merge-laravel

TailwindMerge for Laravel merges multiple Tailwind CSS classes by automatically resolving conflicts between them

341682.2k18](/packages/gehrisandro-tailwind-merge-laravel)[tailwindphp/tailwindphp

A full port of TailwindCSS 4.x to PHP

171.7k1](/packages/tailwindphp-tailwindphp)[arnolem/tailwindphp

TailwindPHP - use Tailwind CSS in your PHP projects (without npm)

131.1k](/packages/arnolem-tailwindphp)[electrik/slate

Slate - a Laravel Blade UI Kit is a set of anonymous blade components built using TailwindCSS v4 with built-in dark mode support for your next Laravel project

102.3k1](/packages/electrik-slate)

PHPackages © 2026

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