yangqi/htmldom

This package is abandoned and no longer maintained. No replacement package was suggested.

Simple Html Dom Parser for Laravel 4

Maintainers

👁 yangqi

Package info

github.com/yangqi/Htmldom

pkg:composer/yangqi/htmldom

Statistics

Installs: 725 845

Dependents: 13

Suggesters: 1

Stars: 92

Open Issues: 12

v1.0.0 2015-09-10 13:45 UTC

Requires

  • php: >=5.3.0

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT eee67c01f0a82c6c5e6252880d382e586e331da7

  • yangqi <i.woop@yangqi.me>

laravelHTML Parser

This package is not auto-updated.

Last update: 2022-04-02 02:10:45 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": "1.0.*"
 }
}

Laravel 5 Setup (same as Laravel 4)

  1. Add the service provider to config/app.php.
'providers' => array(
 ...
	'Yangqi\Htmldom\HtmldomServiceProvider',
 ...
  1. Add alias to config/app.php.
'aliases' => array(	
 ...
	'Htmldom' => 'Yangqi\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