htmlpagedom
htmlpagedom copied to clipboard
jQuery-inspired DOM manipulation extension for Symfony's Crawler
Hi @wasinger, we just ran into the same issue, looking for a simple way to manipulate DOM in PHP in the year 2022... crazy hard. I found this old Symfony...
Given this code: ```php
Hello, I would like to use your class to search a html-code for specific human-readable strings (that are shown in the browser - no hidden HTML-stuff) and replace them with...
When doing the following, the div isn't removed from the html: ``` $objNode = new HtmlPageCrawler('Hallo'); $objNode->filter('.test')->remove(); $x = $objNode->saveHTML(); ``` When doing `$objNode->filter('p')->remove();` the p-elements are correctly removed. Also...
Please review the following test code. Am I doing something wrong here? ```php This works This doesn't work when $span is nested deeper than one level? ```
Code to reproduce: ``` use \Wa72\HtmlPageDom\HtmlPageCrawler; $html =
Code: ``` $c = new HtmlPageCrawler('Paragraph 1 Paragraph 2Paragraph 3'); $c->filter('p')->first()->each(function($element) { $element->replaceWith('ff'); }); echo $c->saveHTML(); ``` Expected: ``` ff Paragraph 2Paragraph 3 ``` Actual: ``` Paragraph 1 Paragraph 2Paragraph...
Due to the urgent need in my project, hope it can help. https://github.com/wasinger/htmlpagedom/issues/18
In original version, if we want to loop all the elements, we have code like this: ``` use \Wa72\HtmlPageDom\HtmlPageCrawler; $c = new HtmlPageCrawler('Paragraph 1 Paragraph 2Paragraph 3'); $c->filter('p')->each(function($element) { $element->html('hi');...
Thx for the great library, really helpful! I'm using it to create docs for my open source modules where I'm parsing markdown to html and then adding some customisations. This...