tales-from-a-dev/twig-tailwind-extra
A Twig extension adding Tailwind CSS filters: tailwind_merge() integrates tailwind-merge-php to resolve conflicting utility classes, while tailwind_classes() builds mergeable class lists for Twig's html_attr() and html_attr_merge(). Requires PHP 8.1+, Twig 3+, and Tailwind 4+.
Architecture Fit
tales-from-a-dev/tailwind-merge-php. It adds no service layer, no persistence, and no runtime infrastructure beyond an optional cache pool. Architecturally it is a leaf dependency, not a platform component.rcrowe/twigbridge or a legacy Symfony/Twig front end). In a Blade-first application the extension is dead weight — the same capability would be delivered by binding tailwind-merge-php behind a Blade directive or a small helper class.cache.twig.tailwind as a cache.system child, cache:clear semantics). Laravel service-provider wiring does not appear in the docs and would need to be authored in-house.Integration Feasibility
Technical Risk
tailwind-merge-php constraint moves in minor releases, so a minor bump can change merged output where the upstream merger fixed a bug. That is an honest disclosure but it means "minor = safe" does not hold for this package. Treat upgrades as behavior changes requiring a visual/regression pass.cache.twig.tailwind. Silent stale-classes-after-deploy is a plausible production failure mode if cache clearing is not part of the deploy pipeline.Key Questions
tailwind-merge-php directly rather than this extension?Stack Fit
{{ active ? 'bg-blue-500' : 'bg-gray-200' }} layered over base classes). This is exactly the conflict-resolution case the package exists for.tailwind_merge()) or a @twMerge() directive over the underlying merger — same behavior, no Twig dependency, no third-party template extension to audit.Migration Path
tailwind_merge() incrementally on the highest-churn components — buttons, cards, form controls — where class conflicts actually occur.tailwind-merge-php behind a local helper. Same merge engine, one layer thinner, and it keeps the dependency inside code we control.Compatibility
tailwind-merge-php.cache.system equivalent (Cache::store()) is wired correctly.Sequencing
Maintenance
composer update is a behavior change, not a patch.Support
Scaling
Failure Modes
tailwind_merge() drops classes it believes conflict. If custom utilities collide with Tailwind's naming, valid classes can be silently discarded. Test arbitrary values and prefixed utilities specifically.Ramp-up
How can I help you explore Laravel packages today?