Recommend this page to a friend! |
Download .zip |
Info | Example | View files (89) | Download .zip | Reputation | Support forum (1) | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2023-02-12 (5 days ago) | 75% | Total: 478 This week: 7 | All time: 5,943 This week: 17 |
Version | License | PHP version | Categories | |||
voku-simple_html_dom 2.0.78 | MIT/X Consortium ... | 5.3 | HTML, PHP 5, Parsers |
Collaborate with this project | Author | |
simple_html_dom - github.com Description This class can manipulate HTML elements using DOMDocument |
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".
composer require voku/simple_html_dom
composer require voku/portable-utf8 # if you need e.g. UTF-8 fixed output
use voku\helper\HtmlDomParser;
require_once 'composer/autoload.php';
...
$dom = HtmlDomParser::str_get_html($str);
// or
$dom = HtmlDomParser::file_get_html($file);
$element = $dom->findOne('#css-selector'); // "$element" === instance of "SimpleHtmlDomInterface"
$elements = $dom->findMulti('.css-selector'); // "$elements" === instance of SimpleHtmlDomNodeInterface<int, SimpleHtmlDomInterface>
$elementOrFalse = $dom->findOneOrFalse('#css-selector'); // "$elementOrFalse" === instance of "SimpleHtmlDomInterface" or false
$elementsOrFalse = $dom->findMultiOrFalse('.css-selector'); // "$elementsOrFalse" === instance of SimpleHtmlDomNodeInterface<int, SimpleHtmlDomInterface> or false
...
github.com/voku/simple_html_dom/tree/master/example
github.com/voku/simple_html_dom/tree/master/README_API.md
For support and donations please visit Github | Issues | PayPal | Patreon.
For status updates and release announcements please visit Releases | Twitter | Patreon.
For professional support please contact me.
Files |
File | Role | Description | ||
---|---|---|---|---|
.github (3 files, 1 directory) | ||||
build (2 files, 1 directory) | ||||
example (16 files) | ||||
src (1 directory) | ||||
tests (12 files, 1 directory) | ||||
.editorconfig | Data | Auxiliary data | ||
.scrutinizer.yml | Data | Auxiliary data | ||
.styleci.yml | Data | Auxiliary data | ||
.travis.yml | Data | Auxiliary data | ||
CHANGELOG | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
phpcs.php_cs | Example | Example script | ||
phpstan.neon | Data | Auxiliary data | ||
phpunit.xml | Data | Auxiliary data | ||
README.md | Doc. | Documentation | ||
README_API.md | Doc. | Documentation |
Files | / | .github |
File | Role | Description | ||
---|---|---|---|---|
workflows (1 file) | ||||
CONTRIBUTING.md | Data | Auxiliary data | ||
FUNDING.yml | Data | Auxiliary data | ||
ISSUE_TEMPLATE.md | Data | Auxiliary data |
Files | / | build |
File | Role | Description | ||
---|---|---|---|---|
docs (1 file) | ||||
composer.json | Data | Auxiliary data | ||
generate_docs.php | Class | Class source |
Files | / | example |
File | Role | Description |
---|---|---|
example_add_content.php | Example | Example script |
example_advanced_selector.php | Example | Example script |
example_basic_selector.php | Example | Example script |
example_extract_data_attribute.php | Example | Example script |
example_extract_html.php | Example | Example script |
example_extract_meta_tags.php | Example | Example script |
example_find_image_if_exists.php | Example | Example script |
example_find_text.php | Example | Example script |
example_modify_attribute.php | Example | Example script |
example_modify_contents.php | Example | Example script |
example_modify_styles_with_svg.php | Example | Example script |
example_remove_comments.php | Example | Example script |
example_remove_content.php | Example | Example script |
example_remove_content_from_table.php | Example | Example script |
example_scraping_imdb.php | Example | Example script |
example_scraping_lebensmittelwarnung.php | Example | Example script |
Files | / | src | / | voku | / | helper |
Files | / | tests |
File | Role | Description | ||
---|---|---|---|---|
fixtures (18 files) | ||||
AuxiliarFunctionsTest.php | Class | Class source | ||
bootstrap.php | Aux. | Auxiliary script | ||
CommentTest.php | Class | Class source | ||
DomManipulationTest.php | Class | Class source | ||
HTML5DOMDocumentTest.php | Class | Class source | ||
HtmlDomParserTest.php | Class | Class source | ||
SimpleHtmlDomMemoryTest.php | Class | Class source | ||
SimpleHtmlDomNodeTest.php | Class | Class source | ||
SimpleHtmlDomTest.php | Class | Class source | ||
SimpleHtmlHelperTest.php | Class | Class source | ||
TwigTest.php | Class | Class source | ||
XmlDomParserTest.php | Class | Class source |
Files | / | tests | / | fixtures |
File | Role | Description |
---|---|---|
big.html | Doc. | Documentation |
horrible.html | Doc. | Documentation |
issue81.html | Doc. | Documentation |
issue81_v2.html | Doc. | Documentation |
small.html | Doc. | Documentation |
test_mail.html | Doc. | Documentation |
test_mail_expected.html | Doc. | Documentation |
test_page.html | Doc. | Documentation |
test_page_plaintext.html | Doc. | Documentation |
test_template.twig | Data | Auxiliary data |
test_template_js.html | Doc. | Documentation |
test_xml.xml | Data | Auxiliary data |
test_xml_complex.xml | Data | Auxiliary data |
test_xml_complex_v2.xml | Data | Auxiliary data |
test_xml_complex_v3.xml | Example | Example script |
test_xml_expected.xml | Data | Auxiliary data |
test_xml_replace_expected.xml | Data | Auxiliary data |
windows-1252-example.html | Doc. | Documentation |
voku-simple_html_dom-2023-02-12.zip 286KB | |
voku-simple_html_dom-2023-02-12.tar.gz 249KB | |
Install with Composer |
Needed packages | ||
Class | Download | Why it is needed | Dependency |
---|---|---|---|
Portable UTF-8 | .zip .tar.gz | Strin | Required |
Version Control | Reuses | Unique User Downloads | Download Rankings | ||||||||||||||||
100% | 4 |
|
|
User Ratings | User Comments (1) | ||||||||||||||||||||||||||||||||||
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.
Other classes that need this package |
Class | Why it is needed | Dependency |
---|---|---|
PHP CSS to Inline Styles | Dom-Manipulation | Required |
PHP HTML Form Validator | HTML-Dom interactions | Required |
PHP HTML Minify Class | Dom-Parsing | Required |
PHP httpful Request | auto-parsing html output | Required |