Copied!

HTML Validator (uses checker.html5.org as backend)

Cloneable Instantiable
Constants
public HtmlValidator\Validator ::CHARSET_BIG5 = 'Big5'
public HtmlValidator\Validator ::CHARSET_BIG5_HKSCS = 'Big5-HKSCS'
public HtmlValidator\Validator ::CHARSET_EUC_JP = 'EUC-JP'
public HtmlValidator\Validator ::CHARSET_EUC_KR = 'EUC-KR'
public HtmlValidator\Validator ::CHARSET_GB18030 = 'GB18030'
public HtmlValidator\Validator ::CHARSET_GBK = 'GBK'
public HtmlValidator\Validator ::CHARSET_ISO_2022_JP = 'ISO-2022-JP'
public HtmlValidator\Validator ::CHARSET_ISO_2022_KR = 'ISO-2022-KR'
public HtmlValidator\Validator ::CHARSET_ISO_8859_1 = 'ISO-8859-1'
public HtmlValidator\Validator ::CHARSET_ISO_8859_13 = 'ISO-8859-13'
public HtmlValidator\Validator ::CHARSET_ISO_8859_15 = 'ISO-8859-15'
public HtmlValidator\Validator ::CHARSET_ISO_8859_2 = 'ISO-8859-2'
public HtmlValidator\Validator ::CHARSET_ISO_8859_3 = 'ISO-8859-3'
public HtmlValidator\Validator ::CHARSET_ISO_8859_4 = 'ISO-8859-4'
public HtmlValidator\Validator ::CHARSET_ISO_8859_5 = 'ISO-8859-5'
public HtmlValidator\Validator ::CHARSET_ISO_8859_6 = 'ISO-8859-6'
public HtmlValidator\Validator ::CHARSET_ISO_8859_7 = 'ISO-8859-7'
public HtmlValidator\Validator ::CHARSET_ISO_8859_8 = 'ISO-8859-8'
public HtmlValidator\Validator ::CHARSET_ISO_8859_9 = 'ISO-8859-9'
public HtmlValidator\Validator ::CHARSET_KOI8_R = 'KOI8-R'
public HtmlValidator\Validator ::CHARSET_SHIFT_JIS = 'Shift_JIS'
public HtmlValidator\Validator ::CHARSET_TIS_620 = 'TIS-620'
public HtmlValidator\Validator ::CHARSET_UTF_16 = 'UTF-16'
public HtmlValidator\Validator ::CHARSET_UTF_8 = 'UTF-8'
 

Characters sets

  • var string
public HtmlValidator\Validator ::CHARSET_WINDOWS_1250 = 'Windows-1250'
public HtmlValidator\Validator ::CHARSET_WINDOWS_1251 = 'Windows-1251'
public HtmlValidator\Validator ::CHARSET_WINDOWS_1252 = 'Windows-1252'
public HtmlValidator\Validator ::CHARSET_WINDOWS_1253 = 'Windows-1253'
public HtmlValidator\Validator ::CHARSET_WINDOWS_1254 = 'Windows-1254'
public HtmlValidator\Validator ::CHARSET_WINDOWS_1255 = 'Windows-1255'
public HtmlValidator\Validator ::CHARSET_WINDOWS_1256 = 'Windows-1256'
public HtmlValidator\Validator ::CHARSET_WINDOWS_1257 = 'Windows-1257'
public HtmlValidator\Validator ::CHARSET_WINDOWS_1258 = 'Windows-1258'
public HtmlValidator\Validator ::DEFAULT_VALIDATOR_URL = 'https://validator.nu'
 

Default validator URL

  • var string
public HtmlValidator\Validator ::PARSER_HTML = 'html'
public HtmlValidator\Validator ::PARSER_HTML4 = 'html4'
public HtmlValidator\Validator ::PARSER_HTML4TR = 'html4tr'
public HtmlValidator\Validator ::PARSER_HTML5 = 'html5'
public HtmlValidator\Validator ::PARSER_XML = 'xml'
 

Parser constants

  • var string
public HtmlValidator\Validator ::PARSER_XMLDTD = 'xmldtd'
Methods
public __construct ( $validatorUrl = 'https://validator.nu' , $parser = 'html5' )
 

Constructs a new validator instance

  • throws UnknownParserException
public getCharset ()
 

Get the charset to report to the validator

  • return string
public getParser ()
 

Get the set parser type

  • return string
public setCharset ( $charset )
 

Set the charset to report to the validator

public setHttpClient ( $httpClient )
 

Set the HTTP client to use for requests

public setParser ( $parser )
 

Set parser to use for the given markup

public validate ( $document , $charset = NULL )
 

Validate a complete document (including DOCTYPE)

public validateDocument ( $document , $charset = NULL )
 

Validate a complete document (including DOCTYPE)

public validateNodes ( $nodes , $charset = NULL )
 

Validates a chunk of HTML/XML. A surrounding document will be
created on the fly based on the formatter specified. Note that
this can lead to unexpected behaviour:

  • Line numbers reported will be incorrect
  • Injected document might not be right for your use case

NOTE: Use validateDocument() whenever possible.

public validateUrl ( $url , $options = [ ] )
 

Validate a URL

Properties
private $defaultCharset
 

Default charset to report to the validator

  • var string
private $httpClient
 

Holds the HTTP client used to communicate with the API

  • var HttpClient
private $nodeWrapper
 

Node wrapper tool

private $parser
 

Parser to use for validating

  • var string
Methods
private getContentTypeString ( $mimeType , $charset )
 

Get a string usable for the Content-Type header,
based on the given mime type and charset

  • return string
private getMimeTypeForParser ( $parser )
 

Get the correct mime-type for the given parser

  • return string
© 2020 Bruce Wells
Search Namespaces \ Classes
Configuration Numbers (0-9.) only