torann/dom-parser

A HTML DOM parser written in PHP7 let you manipulate HTML in a very easy way! Supports invalid HTML. Find tags on an HTML page with selectors just like jQuery. Extract contents from HTML in a single line.

2.0.2 2021-05-17 18:37 UTC

This package is auto-updated.

Last update: 2024-04-18 01:07:25 UTC


README

Latest Stable Version Total Downloads Patreon donate button Donate weekly to this project using Gratipay Donate to this project using Flattr Donate to this project using Paypal

A HTML DOM parser written in PHP7 let you manipulate HTML in a very easy way! Supports invalid HTML. Find tags on an HTML page with selectors just like jQuery. Extract contents from HTML in a single line.

Usage

From a string:

use Torann\DomParser\HtmlDom;

$dom = HtmlDom::fromString($str);

$elements = $dom->find($el_name);

From a file:

use Torann\DomParser\HtmlDom;

$dom = HtmlDom::fromFile($file_name);

$elements = $dom->find($el_name);