Download the PHP package stamat/tailwind-merge-php without Composer

On this page you can find all versions of the php package stamat/tailwind-merge-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package tailwind-merge-php

tailwind-merge-php

Packagist Version PHP Version Tailwind CSS v4 CI

Merge Tailwind CSS class lists without style conflicts — a fast, independent PHP port of dcastil/tailwind-merge, ported directly from the JS source and not a fork of any existing PHP package.

If you are building a complex UI — you should componentize. And if you are using Tailwind and componentizing — you need Tailwind Merge.

Laravel glue ships in the box, so it's ready for Laravel too. The name tailwind-merge-php is deliberate: this is a framework-agnostic PHP package first, and a Laravel plugin second.

Usage

Custom config

Laravel

Framework glue ships in the box and is auto-discovered — no manual provider registration. Install illuminate/support (already present in any Laravel app).

The container binds a single shared, configured instance. In a Laravel app, always resolve through the facade or container (as above) — not TailwindMerge::instance(). That static helper returns a separate instance built from the default config, ignoring anything you set in config/tailwind-merge.php (e.g. prefix, cacheSize), so the two can merge differently.

Publish the config to tune cacheSize, prefix, extend and override:

Development

src/DefaultConfig.php is generated from the upstream JS package — do not edit by hand. The upstream version is pinned in bin/package-lock.json and stamped into the generated file header; bump bin/package.json to move it. CI regenerates and fails on drift.

tests/Fixtures/merge-cases.json holds merge cases extracted from the upstream test suites and verified against the real JS implementation.

Disclaimer

This repo was built with AI — specifically Claude Fable 5 — as a model test, with explicit instructions to follow best practices such as strict test-driven and defensive coding.

I know there are several PHP ports of tailwind-merge, but after reviewing them, I've seen the areas they could be improved upon, so I decided to synthesize my own. I do need it for a project or two.

The main improvement is that the tests come straight from upstream and are treated as law: the behavior contract is the JS tailwind-merge test suite itself, not a hand-picked subset. If upstream and this port disagree, upstream is right and the port is the bug.

With 🫀 @stamat

License

MIT, @stamat. Ported from tailwind-merge (MIT, © Dany Castillo).


All versions of tailwind-merge-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package stamat/tailwind-merge-php contains the following files

Loading the files please wait ...