PHP Classes
elePHPant
Icontem

Simple HTML DOM: Manipulate HTML elements using DOMDocument

Recommend this page to a friend!
  Info   View files Example   View files View files (34)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-03-23 (4 days ago) RSS 2.0 feedNot enough user ratingsTotal: 187 This week: 44All time: 8,010 This week: 20Up
Version License PHP version Categories
voku-simple_html_dom 2.0.36MIT/X Consortium ...5.3HTML, PHP 5, Parsers
Collaborate with this project Author

simple_html_dom - github.com

Description

This class can manipulate HTML elements using DOMDocument

This is a fork of SimpleHTMLDOM package that uses DOMDocument classes instead of HTML string manipulation.

It can parse and tolerate invalid HTML and supports UTF-8 documents

It can search tags on a HTML page with selectors just like jQuery.

  Performance   Level  
Name: Lars Moelleken <contact>
Classes: 13 packages by
Country: Germany Germany
Age: 29
All time rank: 1875120 in Germany Germany
Week rank: 4 Up1 in Germany Germany Up
Innovation award
Innovation award
Nominee: 5x

Details

Build Status Coverage Status codecov.io Scrutinizer Code Quality Codacy Badge SensioLabsInsight Dependency Status Latest Stable Version Total Downloads Latest Unstable Version PHP 7 ready License

A HTML DOM parser written in PHP - let you manipulate HTML in a very easy way!

This is a fork of PHP Simple HTML DOM Parser project but instead of string manipulation we use DOMDocument and modern php classes like "Symfony CssSelector" and "Portable UTF-8".

  • PHP 5.3+ Support
  • PHP-FIG Standard
  • Composer & PSR-4 support
  • PHPUnit testing via Travis CI
  • PHP-Quality testing via SensioLabsInsight
  • UTF-8 Support
  • Invalid HTML Support
  • Find tags on an HTML page with selectors just like jQuery
  • Extract contents from HTML in a single line

Install via "composer require"

composer require voku/simple_html_dom

Quick Start

use voku\helper\HtmlDomParser;

require_once 'composer/autoload.php';

...
$dom = HtmlDomParser::str_get_html($str);
// or 
$dom = HtmlDomParser::file_get_html($file);

$elems = $dom->find('#css-selector');
...

Examples

github.com/voku/simple_html_dom/tree/master/example

  Files folder image Files  
File Role Description
Files folder imageexample (6 files)
Files folder imagesrc (1 directory)
Files folder imagetests (5 files, 1 directory)
Accessible without login Plain text file .editorconfig Data Auxiliary data
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file .styleci.yml Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file CHANGELOG Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  example  
File Role Description
  Accessible without login Plain text file example_advanced_selector.php Example Example script
  Accessible without login Plain text file example_basic_selector.php Example Example script
  Accessible without login Plain text file example_extract_html.php Example Example script
  Accessible without login Plain text file example_modify_attribute.php Example Example script
  Accessible without login Plain text file example_modify_contents.php Example Example script
  Accessible without login Plain text file example_remove_content.php Example Example script

  Files folder image Files  /  src  
File Role Description
Files folder imagevoku (1 directory)

  Files folder image Files  /  src  /  voku  
File Role Description
Files folder imagehelper (6 files)

  Files folder image Files  /  src  /  voku  /  helper  
File Role Description
  Plain text file HtmlDomParser.php Class Class source
  Plain text file SelectorConverter.php Class Class source
  Plain text file SimpleHtmlDom.php Class Class source
  Plain text file SimpleHtmlDomNode.php Class Class source
  Plain text file SimpleHtmlDomNodeBlank.php Class Class source
  Plain text file SimpleHtmlDomNodeInterface.php Class Class source

  Files folder image Files  /  tests  
File Role Description
Files folder imagefixtures (8 files)
  Accessible without login Plain text file bootstrap.php Aux. Auxiliary script
  Plain text file HtmlDomParserTest.php Class Class source
  Plain text file SimpleHtmlDomNodeTest.php Class Class source
  Plain text file SimpleHtmlDomTest.php Class Class source
  Plain text file TwigTest.php Class Class source

  Files folder image Files  /  tests  /  fixtures  
File Role Description
  Accessible without login HTML file big.html Doc. Documentation
  Accessible without login HTML file horrible.html Doc. Documentation
  Accessible without login HTML file small.html Doc. Documentation
  Accessible without login HTML file test_mail.html Doc. Documentation
  Accessible without login HTML file test_mail_expected.html Doc. Documentation
  Accessible without login HTML file test_page.html Doc. Documentation
  Accessible without login Plain text file test_template.twig Data Auxiliary data
  Accessible without login HTML file windows-1252-example.html Doc. Documentation

Downloadvoku-simple_html_dom-2017-03-23.zip 54KB
Downloadvoku-simple_html_dom-2017-03-23.tar.gz
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
Portable UTF-8 Download .zip .tar.gz Strin Required
 Version Control Reuses Unique User Downloads Download Rankings  
 100%2
Total:187
This week:44
All time:8,010
This week:20Up
User Comments (1)
nice
5 months ago (muabshir)
80%StarStarStarStarStar