tales-from-a-dev/tailwind-merge-php
Merge Tailwind CSS classes in PHP with conflict resolution (later utilities win). A maintained fork of tailwind-merge-php, ported from dcastil/tailwind-merge. Supports Tailwind v4.0–v4.3. Requires PHP 8.1+.
Use Case Alignment (Updated):
group-*, peer-*, or updated transition-* variants). The package’s updated merging logic ensures these are handled without conflicts, making it more future-proof for modern Tailwind workflows.Non-Fit Scenarios (Unchanged):
Laravel Compatibility (Updated):
backdrop-blur). Test merging logic with these classes.Dependencies (Updated):
tailwind.config.js uses this version. Mixed versions may cause unexpected merging behavior.Runtime Overhead (Updated):
accent-* for form controls) may increase merging complexity. Profile memory/CPU usage with real-world payloads.Cache::forever for static classes).CSS Specificity Wars (Updated):
peer-hover: vs. manual hover:). Document these in your style guide.!important or @layer directives in Tailwind 4.3 might override merged classes. Test with your project’s CSS architecture.Version Lock (Mitigated):
accent-color, backdrop-*)? If yes, validate merging behavior.@layer or !important in Tailwind 4.3? If so, how will merged classes interact?peer-focus: or group-hover: dynamically.accent-* merging for consistent form styling across components.wire:model updates).backdrop-blur-sm). Identify conflict risks.{{ $class }} accent-blue-500) with the package.merged_{md5($classes)}_v4.3).tailwind.config.js (e.g., custom themes, plugins).mbstring, dom still recommended for HTML parsing).package.json.v0.3.0: composer require tales-from-a-dev/tailwind-merge-php:^0.3.0.v4.3_merged_classes).peer-* handling) to avoid drift.accent-*) to trace merging failures.dd() to inspect merged strings with 4.3 utilities.group-* interactions).peer-hover:focus:). Optimize caching if needed.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| 4.3 utility unsupported | Broken CSS for new features | Manual merge or fork the package |
| Cache key collisions (v4.3) | Stale merged classes | Use versioned cache keys (e.g., v4.3_) |
| Tailwind 4.4 breaks compatibility | Regression in merged classes | Monitor package updates, plan fallback |
| High memory with 4.3 utilities | Server instability | Implement TTL, reduce dynamic classes |
accent-*, peer-*, and backdrop-* classes.group-hover:).!important overrides).How can I help you explore Laravel packages today?