royalmar/simple-html-dom-parser

There is no license information available for the latest version (1.0.2) of this package.

modify SimpleHtmlDom for laravel

1.0.2 2017-05-06 01:29 UTC

This package is not auto-updated.

Last update: 2024-05-11 17:45:45 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>');