monashee/php-simple-html-dom-parser

Laravel wrapper for the PHP Simple HTML DOM Parser package.
19,469 3
Install
composer require monashee/php-simple-html-dom-parser
PHP:>=5.4.0
License:MIT
Last Updated:Oct 2, 2014
Links: GitHub  ·  Packagist
Maintainer: monashee

Laravel PHP Simple HTML DOM Parser

Build Status

Thin wrapper for http://simplehtmldom.sourceforge.net/ and provides the two public static functions

php file_get_html() and php str_get_html()

Installation

Requires

  • PHP 5.4+
  • Laravel 4.2+

Install via Composer by adding the following line to the require block of your composer.json file

"monashee/php-simple-html-dom-parser": "dev-master"

Then run php composer update

Add this line to the providers array in your php app/config/app.php file:

'Monashee\PhpSimpleHtmlDomParser\PhpSimpleHtmlDomParserServiceProvider',

Sample Usage

You could create an alias, but I prefer the DI method.


<?php

use Monashee\PhpSimpleHtmlDomParser\PhpSimpleHtmlDomParser;

class Test {

    /**
     * @var PhpSimpleHtmlDomParser
     */
    protected $parser;

    /**
     * @param PhpSimpleHtmlDomParser $parser
     */
    public function __construct(PhpSimpleHtmlDomParser $parser)
    {
        $this->parser = $parser;
    }

    public function getHtml()
    {
        $html = $this->parser->file_get_html('http://monasheemountainmultimedia.com');

        dd($html);
    }

}

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

634,760,849 9,707
laravel/framework

The Laravel Framework.

584,532,650 34,931
laravel/tinker

Powerful REPL for the Laravel framework.

493,838,477 7,443
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

408,553,772 609
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

387,976,821 4,658