Developed with love by KnpLabs Hire us for your project!
0

SimpleHtmlDomBundle

by erivello

Bundle around Simple HTML DOM library (http://simplehtmldom.sourceforge.net)

SimpleHtmlDomBundle

This bundle provides a simple integration of the Simple HTML DOM Parser into Symfony2.
Simple HTML DOM Parser is a HTML DOM parser written in PHP5+ that let you manipulate HTML,
find tags on an HTML page with selectors just like jQuery and extract contents from HTML.

Build Status

Installation

Installation is very easy, it makes use of Composer.

Add SimpleHtmlDomBundle to your composer.json

"require": {
    "erivello/simple-html-dom-bundle": "dev-master"
}

Register the bundle in app/AppKernel.php:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...

        new Erivello\SimpleHtmlDomBundle\ErivelloSimpleHtmlDomBundle(),
    );
}

Usage

You can access the SimpleHtmlDomBundle by the simple_html_dom service:

<?php

$parser = $this->container->get('simple_html_dom');

$parser->load('http://www.google.com/');

// Find all links
foreach($parser->find('a') as $element) {
    echo $element->href . '<br/>';
}

License

The SimpleHtmlDomBundle is licensed under the MIT license.

Copyright (c) 2012 Edoardo Rivello

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.