fizzka/extractor
最新稳定版本:0.3.5
Composer 安装命令:
composer require fizzka/extractor
包简介
HTML Parser
关键字:
README 文档
README
html extraction library, based on SimpleXML & nokogiri XpathSubquery.php
Benefits
- Simple
- Minimal code
- Fast
- Query results are
SimpleXMLElementinstances - Supports nested css/xpath queries
Installation
#Using packagist: composer require 'fizzka/extractor'
Basic Usage
<?php require_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
统计信息
- 总下载量: 4.87k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-06-06