PHPackages                             zicht/classes - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. zicht/classes

AbandonedLibrary[Utility &amp; Helpers](/categories/utility)

zicht/classes
=============

PHP utility for conditionally joining CSS classes.

2.1.0(4y ago)126.1k1MITPHPPHP ^7.2 || ^8.0

Since Mar 31Pushed 3y ago2 watchersCompare

[ Source](https://github.com/zicht/classes)[ Packagist](https://packagist.org/packages/zicht/classes)[ RSS](/packages/zicht-classes/feed)WikiDiscussions release/2.0.x Synced today

READMEChangelog (2)Dependencies (1)Versions (6)Used By (1)

classes
=======

[](#classes)

Utility function for conditionally joining CSS classes.

[![Build Status](https://camo.githubusercontent.com/cbd585bdcf2a5b4dc92222f68fdbefed371c816902fb6b007a3237b590ed6367/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7a696368742f636c61737365732f6261646765732f6275696c642e706e673f623d72656c65617365253246312e302e78)](https://scrutinizer-ci.com/g/zicht/classes/build-status/release/1.0.x)[![Code Coverage](https://camo.githubusercontent.com/a7e574e10636ff637075b0f4c64afc7c1bc68faf580b2d4f888831fcad046864/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7a696368742f636c61737365732f6261646765732f636f7665726167652e706e673f623d72656c65617365253246312e302e78)](https://scrutinizer-ci.com/g/zicht/classes/?branch=release%2F1.0.x)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/fc006dbba1be6fb8b3577edecb404985df0c3fab922c730b18bb6f14747806ca/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7a696368742f636c61737365732f6261646765732f7175616c6974792d73636f72652e706e673f623d72656c65617365253246312e302e78)](https://scrutinizer-ci.com/g/zicht/classes/?branch=release%2F1.0.x)

Installing
----------

[](#installing)

```
composer require zicht/classes

```

Purpose
-------

[](#purpose)

When building a component (or any piece of HTML, really), it's quite common to render or not render certain CSS classes based on certain variables. If you manually concatenate the class names, it quickly becomes a mess of `if` / `else` or ternary operators. This function helps to keep it readable.

Usage
-----

[](#usage)

```
HtmlClassHelper::classes('art-vandelay'); ⇒ 'art-vandelay'
HtmlClassHelper::classes(['art-vandelay', 'kramerica']); ⇒ 'art-vandelay  kramerica'
HtmlClassHelper::classes(['art-vandelay' => true, 'kramerica' => false]); ⇒ 'art-vandelay'
HtmlClassHelper::classes('art-vandelay', ['kramerica' => false, 'kel-varnsen' => true]); ⇒ 'art-vandelay  kel-varnsen'

```

Credits
-------

[](#credits)

This function was created because the JS equivalent [classnames](https://github.com/JedWatson/classnames) was nice to use in React.

Maintainer
----------

[](#maintainer)

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~859 days

Total

3

Last Release

1665d ago

Major Versions

1.0.0 → 2.0.02018-09-21

PHP version history (3 changes)1.0.0PHP ^5.6

2.0.0PHP ^7

2.1.0PHP ^7.2 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22889608?v=4)[Fabrique automation](/maintainers/zicht-jenkins)[@zicht-jenkins](https://github.com/zicht-jenkins)

---

Top Contributors

[![erik-zicht](https://avatars.githubusercontent.com/u/33859362?v=4)](https://github.com/erik-zicht "erik-zicht (5 commits)")

---

Tags

csspackagistphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zicht-classes/health.svg)

```
[![Health](https://phpackages.com/badges/zicht-classes/health.svg)](https://phpackages.com/packages/zicht-classes)
```

###  Alternatives

[kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

5546.9M182](/packages/kartik-v-yii2-grid)[lochmueller/calendarize

Create a structure for timely controlled tables (e.g. events) and one plugin for the different output of calendar views (list, detail, month, year, day, week...). The extension is shipped with one default event table, but you can also 'calendarize' your own table/model. It is completely independent and configurable! Use your own models as event items in this calender. Development on https://github.com/lochmueller/calendarize

76166.2k14](/packages/lochmueller-calendarize)[jaybizzle/safeurl

A Laravel package to create safe, SEO friendly urls

1789.6k1](/packages/jaybizzle-safeurl)[clausnz/php-helpers

A Collection of useful php helper functions.

3810.4k](/packages/clausnz-php-helpers)

PHPackages © 2026

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