PHP code example of wimski / html-data-extractor

1. Go to this page and download the library: Download wimski/html-data-extractor 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/ */

    

wimski / html-data-extractor example snippets


use Wimski\HtmlDataExtractor\Extractors\HtmlDataExtractor;
use Wimski\HtmlDataExtractor\Factories\SelectorFactory;
use Wimski\HtmlDataExtractor\HtmlLoader;
use Wimski\HtmlDataExtractor\Source\SourceParser;
use Wimski\HtmlDataExtractor\Matching\GroupMatcher;
use Wimski\HtmlDataExtractor\Matching\PlaceholderMatcher;
use Wimski\HtmlDataExtractor\Template\TemplateDataExtractor;
use Wimski\HtmlDataExtractor\Template\TemplateGroupsValidator;
use Wimski\HtmlDataExtractor\Template\TemplateParser;
use Wimski\HtmlDataExtractor\Template\TemplateRootNodeExtractor;
use Wimski\HtmlDataExtractor\Template\TemplateValidator;

$htmlLoader                = new HtmlLoader();
$placeholderMatcher        = new PlaceholderMatcher();
$groupMatcher              = new GroupMatcher();
$templateGroupsValidator   = new TemplateGroupsValidator($htmlLoader, $groupMatcher);
$templateValidator         = new TemplateValidator($templateGroupsValidator);
$selectorFactory           = new SelectorFactory($placeholderMatcher);
$templateDataExtractor     = new TemplateDataExtractor($placeholderMatcher);
$templateRootNodeExtractor = new TemplateRootNodeExtractor($htmlLoader);

$templateParser = new TemplateParser(
    $templateValidator,
    $groupMatcher,
    $selectorFactory,
    $templateRootNodeExtractor,
    $templateDataExtractor,
);

$sourceParser = new SourceParser();

$htmlDataExtractor = new HtmlDataExtractor(
    $templateParser,
    $sourceParser,
);