PHP code example of zsxsoft / php-w3c-validator
1. Go to this page and download the library: Download zsxsoft/php-w3c-validator 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/ */
zsxsoft / php-w3c-validator example snippets
use Zsxsoft\W3CValidator\W3CValidator;
$validator = new W3CValidator();
print_r($validator->fileName('http://localhost')->run());
use Zsxsoft\W3CValidator\W3CValidator;
$validator = new W3CValidator();
print_r($validator->data('<html></html>')->run());
Array(
[normal] => NULL
[error] => stdClass Object
(
[messages] => Array
(
[0] => stdClass Object
(
[type] => error
[lastLine] => 1
[lastColumn] => 6
[firstColumn] => 1
[message] => Start tag seen without seeing a doctype first. Expected “<!DOCTYPE html>”.
[extract] => <html></html
[hiliteStart] => 0
[hiliteLength] => 6
)
[1] => stdClass Object
(
[type] => error
[lastLine] => 1
[lastColumn] => 13
[firstColumn] => 7
[message] => Element “head” is missing a