Drupal 8 Html::load()

/** @var string $html */
$html = <<<HTML
         <a href="/" title="home">Home</a>
HTML;
/** @var DOMElement $element */
foreach (Drupal\Component\Utility\Html::load($html)->getElementsByTagName('a') as $element) {
    $href = $element->getAttribute('href');
    $title = $element->getAttribute('title');
    echo "{$title} is redirecting to {$href}" . PHP_EOL;
}