royalmar / simple-html-dom-parser
modify SimpleHtmlDom for laravel
Installs: 13 032
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 1
Open Issues: 1
Requires
- php: >=5.3.3
This package is not auto-updated.
Last update: 2024-11-23 20:42:33 UTC
README
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>');