ZiJie-Li / HtmlDomParser by royalmar

modify SimpleHtmlDom for laravel
13,019
3
1
Package Data
Maintainer Username: royalmar
Maintainer Contact: royal-mar@hotmail.com (royalmar)
Package Create Date: 2017-01-07
Package Last Update: 2017-05-06
Language: PHP
License: Unknown
Last Refreshed: 2024-11-22 03:12:58
Package Statistics
Total Downloads: 13,019
Monthly Downloads: 194
Daily Downloads: 1
Total Stars: 3
Total Watchers: 1
Total Forks: 1
Total Open Issues: 1

SimpleHtmlDomParser

Add library Simple html dom to Laravel More document: http://simplehtmldom.sourceforge.net/

##How to install

composer require royalmar/simple-html-dom-parser

##Laravel Setup Add the service provider to config/app.php:

'providers' => array(
    ...
    'Royalmar\HtmlDomParser\HtmlDomParserServiceProvider',

    //Laravel 5.1+
    Royalmar\HtmlDomParser\HtmlDomParserServiceProvider::class,
    ...

Add alias to config/app.php:

'aliases' => array( 
    ...
    'HtmlDomParser' => 'Royalmar\HtmlDomParser\HtmlDomParser',

    //Laravel 5.1+
    'HtmlDomParser' => Royalmar\HtmlDomParser\HtmlDomParser::class,
    ...

##Usage

$parser = new \HtmlDomParser();
// get html dom from file
$html = $parser->fileGetHtml('http://www.google.com');
// get html dom from string
$html = $parser->strGetHtml('<p>Hello World</p>');

//OR

// get html dom from file
$html = \HtmlDomParser::fileGetHtml('http://www.google.com');
// get html dom from string
$html = \HtmlDomParser::strGetHtml('<p>Hello World</p>');