Skip to content

denshoch/utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Denshoch Utils

Utility class used in Denshoch softwares.

Install

composer install

Usage

removeControlChars()

Remove Unicode control characters from input text.

$text = "�&#x1";
\Denshoch\Utils::removeControlChars( $text );
var_dump( $text ); #=> ''

HtmlModifier

$html = "<div><p>Hello, world!</p></div>";
$result = \Denshoch\HtmlModifier::addClass($html, 'p', 'my-class');
=> '<div><p class="my-class">Hello, world!</p></div>'


$html = "<div><p>Hello, world!</p></div>";
$tagClassPairs = [
    'p' => 'my-class',
    'div' => 'my-other-class'
];
$result = HtmlModifier::addClassMultiple($html, $tagClassPairs);
=> '<div class="my-other-class"><p class="my-class">Hello, world!</p></div>'

Test

vendor/bin/phpunit --bootstrap vendor/autoload.php tests

About

Utility class used in Denshoch softwares.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages