Martyrer / simple-html-dom-bundle
围绕 Simple HTML DOM 库的包
1.2
2023-04-20 09:48 UTC
Requires
- php: ^7.1
- symfony/framework-bundle: ~3.4|~4.0
Requires (Dev)
- phpunit/phpunit: 6.5.*
- symfony/browser-kit: ~3.4|~4.0
This package is not auto-updated.
Last update: 2024-09-19 16:53:07 UTC
README
此包提供了将 Simple HTML DOM 解析器 简单集成到 Symfony 3.4/4.0 的功能。Simple HTML DOM 解析器是一个用 PHP5+ 编写的 HTML DOM 解析器,它允许您像 jQuery 一样使用选择器来操作 HTML、在 HTML 页面上查找标签,并从 HTML 中提取内容。
安装
安装非常简单,它使用了 Composer。
将 SimpleHtmlDomBundle 添加到您的 composer.json 中
composer require martyrer/simple-html-dom-bundle
使用
您可以通过 simple_html_dom
服务访问 SimpleHtmlDomBundle
<?php $parser = $this->container->get('simple_html_dom'); $parser->load('http://www.google.com/'); // Find all links foreach($parser->find('a') as $element) { echo $element->href . '<br/>'; }
许可证
SimpleHtmlDomBundle 使用 MIT 许可证。