hieu-le/body-classes

Add classes to the body element dynamically.

1.0.0 2015-11-16 03:57 UTC

This package is auto-updated.

Last update: 2022-01-05 14:34:29 UTC


README

Add classes to the body element dynamically.

Installation

Use Composer

Add this package as your dependency:

$> composer require hieu-le/body-classes

Do not use Composer

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

Usage

First, create a single object which holds all classes:

<?php
$body = new \HieuLe\BodyClasses\Body();
?>

When you want to add new classes:

<?php
$body->addClasses('class-1 class-2');

// OR

$body->addClasses(array('class-1', 'class-2'));
?>

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

Finnaly, when you want to print these classes:

<?
echo $body->getClasses();
?>