To install the package use composer
composer require htmlxpath/htmlxpath
Then you can use it to consume webpages and extract content with xpath.
<?php require 'vendor/autoload.php'; foreach(HTMLXPath\xpath('http://www.seanbehan.com', '//a/text()') as $node) echo $node->nodeValue;
It's just a wrapper that creates and sets up a few objects exposing them as generators.
I am quite impressed with the PHP community these days. The number of packages and the way things "just work" is top notch.