Port PEAR package HTMLValidator
Rewritten to use the new API https://validator.w3.org/docs/api.html
- PHP >= 8.0.2
composer require gemorroj/htmlvalidator
<?php
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());