Written by Sean Behan on Tue Mar 28th 2017

I just wrote and published my first PHP package on Packagist.com. It's available on packagist.org and the source code is on github.

To install the package use composer

composer require htmlxpath/htmlxpath

Then you can use it to consume webpages and extract content with xpath.

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.

Tagged with..
#PHP #XPath #XML #Packaging #Development

Just finishing up brewing up some fresh ground comments...