PHP code example of ytekeli / dom-selector

1. Go to this page and download the library: Download ytekeli/dom-selector 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/ */

    

ytekeli / dom-selector example snippets


// Assuming you installed from Composer:
ing = '
title:
    css: "h1"
    type: Text
link:
    css: "h2 a"
    type: Link';

$selector = DOMSelector::fromYamlString($yaml_string);
$extracted = $selector->extract('<h1>Title</h1><h2>Usage <a class="headerlink" href="https://example.com">¶</a></h2>');

print_r($extracted);