PHP code example of netzmacht / php-dom-manipulator

1. Go to this page and download the library: Download netzmacht/php-dom-manipulator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

netzmacht / php-dom-manipulator example snippets


 

$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();

$ php composer.phar  update