PHP code example of gemorroj / htmlvalidator

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

    

gemorroj / htmlvalidator example snippets



use HTMLValidator\HTMLValidator;

$validator = new HTMLValidator();
$result = $validator->validateFragment('<html lang="en"><body> </body></html>');
$result = $validator->validateFile('/path/to/file.html');
$result = $validator->validateUri('http://example.com');

var_dump($result->isValid());

print_r($result->getErrors());
print_r($result->getWarnings());