Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

Latest commit

 

History

History
44 lines (31 loc) · 1.62 KB

README.md

File metadata and controls

44 lines (31 loc) · 1.62 KB

PHP Dom document manipulator

Build Status Version License Downloads

This library provides a rule based dom document manipulator.

Install

This library can be installed using composer

$ php composer.phar require netzmacht/php-dom-manipulator:~1.0
$ php composer.phar update

Usage

<?php 

$converter   = new Netzmacht\DomManipulator\Converter\DomDocumentConverter();
$manipulator = new Netzmacht\DomManipulator\DomManipulator($converter);

$query = new Netzmacht\DomManipulator\Query\XPathQuery('xpath query');
$rule  = new Netzmacht\DomManipulator\Rule\AttributeRule($query, 'class');

$result = $manipulator
    ->addRule($rule)
    ->loadHtml('<html>   </html>')
    ->manipulate();

Credits

This library initially was extracted from the toflar/contao-css-class-replacer which is maintained by Yanick Witschi alias @Toflar.