· 1 min read

I Just Published My First PHP Package HTMLXPATH

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.

<?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.

Comments

Leave a comment