Search code examples
phphtmldomlaravel-5simple-html-dom

How use simple_html_dom in laravel


I want to use simple_html_dom in my Laravel project. but I can't add this package to my project.

How can I use simple_html_dom in laravel?


Solution

  • There are several ways, one of them using composer. Run this command from the command line:

    composer require sunra/php-simple-html-dom-parser
    

    Example usage:

    use Sunra\PhpSimple\HtmlDomParser;
    
    $document = HtmlDomParser::str_get_html($html_text);
    $document->find($selector);