// create an instance of the HTML Parser class object
$dom = new \HTML\Document;
// import the HTML and create the DOM
// note: you must have already loaded the HTML in the PHP variable named $html
$IsSuccessful = $dom->load( $html );
// get a reference to the node with the ID
$element = $dom->findById( ‘blah’ );
// add a new attribute to the element, or modify an existing attribute
$element->setAttribute( ‘a’, ‘b’ );
// convert the DOM in the HTML Parser object to an HTML string
$html = $dom->export();