- How do I install `tales-from-a-dev/tailwind-merge-php` in a Laravel project?
- Run `composer require tales-from-a-dev/tailwind-merge-php` in your Laravel project directory. Ensure your project uses PHP 8.1+ and Tailwind CSS v4.0–4.3. No additional Laravel-specific setup is required beyond requiring the package.
- Does this package support Tailwind CSS v4.3’s new utilities like `accent-*` or `backdrop-blur`?
- Yes, this package explicitly supports Tailwind v4.3, including its latest utilities. Later-defined classes (e.g., `accent-blue-500`) will override conflicting ones, ensuring compatibility with v4.3’s expanded feature set.
- Will this work with Livewire or Alpine.js dynamic classes?
- Absolutely. The package is ideal for dynamic UIs. Use it to merge classes in Livewire/Alpine components, like merging hover or focus states (`peer-hover:focus` or `group-hover:bg-blue-500`) at runtime without specificity conflicts.
- How does caching work with this package? Should I cache merged results?
- Yes, caching is highly recommended for performance. Use Laravel’s `Cache::forever()` or similar to store merged class strings, especially for static or frequently reused components. This avoids reprocessing the same class combinations repeatedly.
- What happens if I mix Tailwind v4.0 and v4.3 classes? Will it break?
- The package supports v4.0–4.3, but mixing versions in `tailwind.config.js` may cause unexpected merging behavior. Stick to a single Tailwind version in your project to ensure consistent conflict resolution.
- Can I use this package with Inertia.js for React/Vue client-side rendering?
- Yes, pass merged classes from Laravel to Inertia.js (e.g., via props or shared state). The merged classes will retain Tailwind’s utility logic, ensuring consistent styling on the client side.
- Are there performance concerns with merging many classes (e.g., 100+)?
- The package is optimized for performance, but merging large class lists may introduce minor overhead. Benchmark your use case, and cache results aggressively. Tailwind v4.3’s expanded utilities might slightly increase processing time.
- What if a Tailwind utility isn’t supported in this package?
- Check the [UPGRADE.md](https://github.com/tales-from-a-dev/tailwind-merge-php/blob/main/UPGRADE.md) guide for known limitations. If a utility is missing, manually merge it or file an issue. As a fallback, pre-merge classes at build time with PostCSS.
- How do I handle `@layer` or `!important` directives in Tailwind v4.3?
- The package prioritizes later-defined classes, but `@layer` or `!important` in your CSS may override merged utilities. Document these conflicts in your style guide and test merged classes against your project’s CSS architecture.
- What’s the difference between this package and the original `tailwind-merge-php`?
- This is a maintained fork with explicit Tailwind v4.0–4.3 support, PHP 8.1+ requirements, and updated merging logic for newer utilities. It includes bug fixes and better compatibility with modern Laravel (9.x/10.x) and Tailwind workflows.