denshoch/utils

Utility class used in Denshoch softwares.

Installs: 579

Dependents: 2

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

pkg:composer/denshoch/utils

v1.2.0 2024-11-20 13:54 UTC

This package is auto-updated.

Last update: 2025-09-20 15:31:22 UTC


README

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