<?php
use Symfony\Component\CssSelector\CssSelectorConverter;
$xpathStr = (new CssSelectorConverter())->toXpath('h1:first-child');
$file = __DIR__ . '/templates/site.html';
// ###### using PHP DOM ######
$dom = new DOMDocument();
$dom->loadHTMLFile($file);
$xpath = new DOMXPath($dom);
$domElement = $xpath->evaluate($xpathStr)->item(0);
echo $domElement->nodeValue . PHP_EOL;