gdianov/araneus
Composer 安装命令:
composer require gdianov/araneus
包简介
Araneus is php library for flexible parsing of data from different sources
README 文档
README
Araneus is php library for flexible parsing of data from different sources
Supported Sources: docx, txt, http resources
- The minimum required PHP version >= PHP 7.0.
For install use command: composer require gdianov/araneus
How to use?
- Create Rule
<?php require_once 'vendor/autoload.php'; //Create new Rule class TitleRule extends \Araneus\Rules\BaseRule implements \Araneus\Interfaces\RuleInterface { public function getPattern(): string { return '|<title[^>]*?>(.*?)</title>|sei'; } }
- Create Http Parser
$parseHttp = new \Araneus\Parser( new \Araneus\Http\Http('https://google.com') ); //Attach created rule $parseHttp->attachRules(new TitleRule()); //You can attach many rules $result = $parser->run()->fetch(); //array key = regexp, value = found values $result = $parser->run()->fetchRules(); //array of Rule objects ...
- Create Plain Text Parser
$parseTxt = new \Araneus\Parser( new \Araneus\File\FilePlainText(__DIR__.'/dst/txt/demo.txt') ); $parseTxt->attachRules( new NumberRule(), new DirtyWordsRule(), new UidRule() ); $result = $parseTxt->run()->fetch();
- Create Microsoft Word Document Parser
$parseDocx = new \Araneus\Parser( new \Araneus\File\FileDocument(__DIR__.'/dst/documents/demo.docx') ); $parseDocx->attachRules( new UsersRule(), new LinksToBooksRule() ); $result = $parseDocx->run()->fetch();
You can expand the possibilities by adding your sources or modify existing ones by implementing the interfaces: SourceInterface, ContentInterface, RuleInterface
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-25