iloh/simple-html-dom-bundle

The maintained version of 'Bundle around Simple HTML DOM library'

Installs: 1 809

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 12

Type:symfony-bundle

1.1.3 2021-10-26 21:53 UTC

This package is auto-updated.

Last update: 2022-07-26 23:37:27 UTC


README

Original package https://github.com/erivello/SimpleHtmlDomBundle was abandoned. This is attempt to giving to good bundle second chance. This bundle provides a simple integration of the Simple HTML DOM Parser into Symfony 5. ##I will do my best to support and timely update this package to supporting latest Symfony version.

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.

Installation

Installation is very easy, it makes use of Composer.

composer require iloh/simple-html-dom-bundle

Register the bundle in app/AppKernel.php:

<?php
// app/AppKernel.php

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

        new Iloh\SimpleHtmlDomBundle\SimpleHtmlDomBundle(),
    );
}

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.