Skip to content

Latest commit

History

36 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

extractor

html extraction library, based on SimpleXML & nokogiri XpathSubquery.php

Latest Stable VersionBuild StatusCoveralls

Benefits

  • Simple
  • Minimal code
  • Fast
  • Query results are SimpleXMLElement instances
  • Supports nested css/xpath queries

Installation

#Using packagist:
composer require 'fizzka/extractor'

Basic Usage

<?phprequire_once'vendor/autoload.php';
$html = gzdecode(file_get_contents('http://habrahabr.ru/'));
$ex = Extractor::fromHtml($html);
var_dump($ex->get('a.habracut'));

Advanced Usage

echo$ex->cssPathFirst('div.post')->xpathFirst('.//@href');
foreach ($ex->cssPath('div.post') as$post) {
var_dump($post->cssPathFirst('a.post_title'));
}

Testing

Just run phpunit from the top of project

Contribute

Feel free to use & contribute ;)

License

MIT

About

html extraction library, based on SimpleXml & nokogiri XpathSubquery.php

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages