PHPackages                             hieu-le/body-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. hieu-le/body-classes

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

hieu-le/body-classes
====================

Add classes to the body element dynamically.

1.0.0(10y ago)12.6k1MITPHP

Since Nov 16Pushed 10y agoCompare

[ Source](https://github.com/letrunghieu/body-classes)[ Packagist](https://packagist.org/packages/hieu-le/body-classes)[ RSS](/packages/hieu-le-body-classes/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (2)Used By (1)

Body classes
============

[](#body-classes)

Add classes to the body element dynamically.

Installation
------------

[](#installation)

### Use Composer

[](#use-composer)

Add this package as your dependency:

```
$> composer require hieu-le/body-classes

```

### Do not use Composer

[](#do-not-use-composer)

Require the `src/Body.php` file into your code.

Usage
-----

[](#usage)

First, create a single object which holds all classes:

```

```

When you want to add new classes:

```

```

If the new added classes were added before, they will be ignored.

Finnaly, when you want to print these classes:

```

```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

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

Unknown

Total

1

Last Release

3880d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/98ce9136dff54b74ddb9afe69ae5c9c0cf573b00603e80ad9ee332f24f0b1342?d=identicon)[letrunghieu](/maintainers/letrunghieu)

---

Top Contributors

[![letrunghieu](https://avatars.githubusercontent.com/u/1145335?v=4)](https://github.com/letrunghieu "letrunghieu (9 commits)")

---

Tags

classesdynamicbody

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hieu-le-body-classes/health.svg)

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

###  Alternatives

[gehrisandro/tailwind-merge-laravel

TailwindMerge for Laravel merges multiple Tailwind CSS classes by automatically resolving conflicts between them

341876.3k28](/packages/gehrisandro-tailwind-merge-laravel)[lorisleiva/lody

Load files and classes as lazy collections in Laravel.

957.9M15](/packages/lorisleiva-lody)[gehrisandro/tailwind-merge-php

TailwindMerge for PHP merges multiple Tailwind CSS classes by automatically resolving conflicts between them

1391.8M12](/packages/gehrisandro-tailwind-merge-php)[digital-creative/conditional-container

Provides an easy way to conditionally show and hide fields in your Nova resources.

114606.7k4](/packages/digital-creative-conditional-container)[sulu/form-bundle

Bundle for creating forms in Sulu.

88306.7k8](/packages/sulu-form-bundle)[mathiasverraes/classfunctions

Functions to manipulate class names

34494.3k10](/packages/mathiasverraes-classfunctions)

PHPackages © 2026

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