Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Twig Classes

Twig Classes Laravel Package

zicht/twig-classes

A Twig extension for building CSS class lists in templates. Add classes conditionally, merge class arrays, and output clean class attributes without messy inline logic, keeping Twig markup readable and maintainable in Laravel/PHP projects.

View on GitHub
Deep Wiki
Context7

zicht/twig-classes adds a convenient classes helper to Twig, letting you build conditional CSS class strings directly in your templates. Inspired by Laravel's @class directive, it keeps markup clean by replacing clumsy ternary chains and string concatenation with a readable array syntax—so only the classes that evaluate to true are rendered.

  • Conditionally add classes from arrays or key/value maps
  • Clean, readable alternative to inline ternaries
  • Works with any Twig environment, including Laravel/Twig integrations
  • Preserves class order and skips empty or false values
  • Zero configuration—just register the extension and use it
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource