hieu-le / body-classes
Add classes to the body element dynamically.
Installs: 2 609
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires (Dev)
- codeclimate/php-test-reporter: dev-master
- phpunit/phpunit: ^4.0
This package is auto-updated.
Last update: 2024-12-05 20:48:42 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();
?>