jeffreyvr / htmldom
Simple Html Dom Parser for Laravel
1.1.0
2021-12-31 15:07 UTC
Requires
- php: ^7.4|^8.0
Requires (Dev)
- phpcompatibility/php-compatibility: 9.3.5
- squizlabs/php_codesniffer: ^3.1.0
This package is auto-updated.
Last update: 2024-12-29 06:34:54 UTC
README
A Htmldom package for Laravel based on Simple HTML Dom Parser.
Link: Original package
Installation
Add the following line to the require
section of composer.json
:
composer require jeffreyvr/Htmldom
Setup
Only needed for older Laravel versions.
- Add the service provider to
config/app.php
.
'providers' => array( ... 'Yangqi\Htmldom\HtmldomServiceProvider', ...
- Add alias to
config/app.php
.
'aliases' => array( ... 'Htmldom' => 'Yangqi\Htmldom\Htmldom', ...
Usage
- Use following:
$html = new \Htmldom('http://www.example.com'); // Find all images foreach($html->find('img') as $element) echo $element->src . '<br>'; // Find all links foreach($html->find('a') as $element) echo $element->href . '<br>';
See the detailed documentation http://simplehtmldom.sourceforge.net/manual.htm