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)08.0k↓16.7%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 today

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 69% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity53

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

571d ago

Major Versions

1.0.0 → 2.0.02022-10-06

2.0.1 → 3.0.0-rc12024-12-10

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/61181331?v=4)[Kor Control](/maintainers/korcontrol)[@korcontrol](https://github.com/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

22920.3M88](/packages/twig-cssinliner-extra)[nochso/html-compress-twig

Twig extension for compressing HTML and inline CSS/Javascript

79471.5k8](/packages/nochso-html-compress-twig)[wbrowar/guide

A CMS Guide for Craft CMS.

6154.7k1](/packages/wbrowar-guide)[viget/craft-classnames

Classnames plugin for Craft CMS

1115.5k1](/packages/viget-craft-classnames)[odan/twig-assets

Caching and compression for Twig assets (JavaScript and CSS).

2223.7k4](/packages/odan-twig-assets)

PHPackages © 2026

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