PHP code example of gwa / dom-inspector
1. Go to this page and download the library: Download gwa/dom-inspector library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gwa / dom-inspector example snippets
// return NodeList containing all LIs
$inspector->find('ul')->children();
// return NodeList containing second LI
$inspector->find('ul')->children(1);
// return NodeList containing all LIs with class 'active'
$inspector->find('ul')->children('.active');
$inspector->children('article')->first()->text();
$blanks = [];
$links = $inspector->find('a');
foreach ($links as $link) {
if ($link->attr('target') === '_blank') {
$blanks[] = $link;
}
}