PHPackages                             korcontrol/craft-classy - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. korcontrol/craft-classy

ActiveCraft-plugin[Templating &amp; Views](/categories/templating)

korcontrol/craft-classy
=======================

Twig helpers inspired by https://github.com/JedWatson/classnames

2.0.1(2y ago)07.8k↓50%1MITPHP

Since Mar 23Pushed 1y ago1 watchersCompare

[ Source](https://github.com/korcontrol/craft-classy)[ Packagist](https://packagist.org/packages/korcontrol/craft-classy)[ RSS](/packages/korcontrol-craft-classy/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (6)Used By (0)

Classy plugin for Craft CMS 5.x
===============================

[](#classy-plugin-for-craft-cms-5x)

Twig helpers inspired by

Usage
-----

[](#usage)

### Filter

[](#filter)

```
{% apply class(
  "add-this-initially",
  {
    "add-this": true,
    "remove-this": false,
    "neither-add-nor-remove": null,
    "add-or-remove": ifthis and ifthat,
    "add-but-dont-remove": condition ? true : null,
    "remove-but-dont-add": not condition ? false : null,
  },
  "add-this-regardless-of-above",
) %}
   ...
{% endapply %}
```

### Function

[](#function)

```

```

Which depending on the conditions `ifthis` and `ifthat` will give

```
 or
```

---

Each argument can be either a string or a map.

A string argument will be treated as a class name (or multiple space-separated class names) to add.

An array argument is a map of class names to statuses.

Its keys are single class names or groups of space-seprated classes. The corresponding values can be

- strictly `true` to add the class or classes
- strictly `false` to remove the class or classes
- `null` or anything else to leave them alone

Any existing classes which aren't mentioned in any of these arguments are left alone.

Arguments are processed in order.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~331 days

Total

4

Last Release

524d ago

Major Versions

1.0.0 → 2.0.02022-10-06

2.0.1 → 3.0.0-rc12024-12-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/f7cbd54e9097486232a2bd40ef4dca8aa1457bdd5f521eb7076b113804bbbc8a?d=identicon)[korcontrol](/maintainers/korcontrol)

---

Top Contributors

[![ccchapman](https://avatars.githubusercontent.com/u/42548502?v=4)](https://github.com/ccchapman "ccchapman (3 commits)")[![aaronrobb](https://avatars.githubusercontent.com/u/677551?v=4)](https://github.com/aaronrobb "aaronrobb (1 commits)")[![justinmacleod](https://avatars.githubusercontent.com/u/575902?v=4)](https://github.com/justinmacleod "justinmacleod (1 commits)")

---

Tags

twigcss

### Embed Badge

![Health badge](/badges/korcontrol-craft-classy/health.svg)

```
[![Health](https://phpackages.com/badges/korcontrol-craft-classy/health.svg)](https://phpackages.com/packages/korcontrol-craft-classy)
```

###  Alternatives

[twig/cssinliner-extra

A Twig extension to allow inlining CSS

22918.5M55](/packages/twig-cssinliner-extra)[nochso/html-compress-twig

Twig extension for compressing HTML and inline CSS/Javascript

84468.6k8](/packages/nochso-html-compress-twig)[nystudio107/craft-twigpack

Twigpack is a bridge between Twig and webpack, with manifest.json &amp; webpack-dev-server HMR support

97341.4k17](/packages/nystudio107-craft-twigpack)[nystudio107/craft-autocomplete

Provides Twig template IDE autocomplete of Craft CMS &amp; plugin variables

44204.4k13](/packages/nystudio107-craft-autocomplete)[viget/craft-classnames

Classnames plugin for Craft CMS

1115.5k1](/packages/viget-craft-classnames)[nystudio107/craft-emptycoalesce

Empty Coalesce adds the ??? operator to Twig that will return the first thing that is defined, not null, and not empty.

28143.7k3](/packages/nystudio107-craft-emptycoalesce)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
