PHP code example of innmind / html

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

    

innmind / html example snippets


use Innmind\Html\{
    Reader,
    Document,
};
use Innmind\Xml\{
    Node,
    Element,
    Element\Custom,
};
use Innmind\Filesystem\File\Content;
use Innmind\Immutable\Maybe;

$read = Reader::new();

$html = $read(
    Content::ofString(\file_get_contents('https://github.com/')),
); // Maybe<Document|Element|Custom|Node>

use Innmind\Html\Visitor\Elements;

$h1s = Elements::of('h1')($html);