fahmiardi / htmldom
Simple Html Dom Parser for Laravel 4
1.0
2015-05-06 08:35 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2026-03-18 15:40:09 UTC
README
A Htmldom package for Laravel 4 and 5 based on Simple HTML Dom Parser
Installation
Add the following line to the require section of composer.json:
{
"require": {
"yangqi/htmldom": "dev-master"
}
}
Laravel 5 Setup (same as Laravel 4)
- 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