Skip to content

larammerce/html-dom

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HtmlDom

A HtmlDom package for Laravel 8 based on Simple HTML Dom Parser

Installation

Add the following line to the require section of composer.json:

{
  "require": {
    "larammerce/html-dom": "1.1.*"
  }
}

Laravel 8 Setup

  1. Add the service provider to config/app.php.
'providers' => array(
    ...
	'Larammerce\HtmlDom\HtmlDomServiceProvider',
    ...
  1. Add alias to config/app.php.
'aliases' => array(	
    ...
	'HtmlDom' => 'Larammerce\HtmlDom\HtmlDom',
    ...

Usage

  1. 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

About

A Htmldom package for Laravel 4 based on Simple HTML Dom Parser

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%