2017 © Pedro Peláez
 

library php-w3c-validator

The PHP binding of vnu.jar (The Nu Html Checker)

image

zsxsoft/php-w3c-validator

The PHP binding of vnu.jar (The Nu Html Checker)

  • Sunday, December 3, 2017
  • by zsx
  • Repository
  • 2 Watchers
  • 4 Stars
  • 623 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 37 % Grown

The README.md

php-w3c-validator

Latest Stable Version Packagist, (*1)


Wrapper for The Nu Html Checker (v.Nu), (*2)

> Current version: 17.11.1

Attention

You need install Java for working with php-w3c-validator
Visit https://java.com for download Java if you not have it, (*3)

Installation

composer require zsxsoft/php-w3c-validator, (*4)

Test

phpunit, (*5)

Usage

Recommend, (*6)

<?php
use Zsxsoft\W3CValidator\W3CValidator;

$validator = new W3CValidator();
print_r($validator->fileName('http://localhost')->run());
<?php
use Zsxsoft\W3CValidator\W3CValidator;

$validator = new W3CValidator();
print_r($validator->data('<html></html>')->run());

Result, (*7)

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 required instance of child element “title”.
                            [extract] => <html></html>
                            [hiliteStart] => 6
                            [hiliteLength] => 7
                        )

                )

        )

)

API

__construct

mixed Zsxsoft\W3CValidator\W3CValidator::__construct(string $jarPath)

W3CValidator constructor., (*8)

Arguments

  • $jarPath string

data

$this|string Zsxsoft\W3CValidator\W3CValidator::data(string $data)

Gets or directly sets HTML data, (*9)

fileName

$this|string Zsxsoft\W3CValidator\W3CValidator::fileName(string $data)

Gets or sets files, "-" for the text set by data., (*10)

  • Default: -

run

mixed|array Zsxsoft\W3CValidator\W3CValidator::run()

Run the validator, (*11)

exec

array Zsxsoft\W3CValidator\W3CValidator::exec($argument, $callback = NULL)

Run the validator with custom argument, (*12)

javaArgument

$this|string Zsxsoft\W3CValidator\W3CValidator::javaArgument(string $data)

Gets or sets Java argument, (*13)

Arguments

  • $argument mixed
  • $callback callable - callback for piping

Command Line Arguments

See https://github.com/validator/validator for help., (*14)

asciiquotes

 $this|string Zsxsoft\W3CValidator\W3CValidator::asciiquotes()

Specifies whether ASCII quotation marks are substituted for Unicode smart quotation marks in messages., (*15)

errors_only

 $this|string Zsxsoft\W3CValidator\W3CValidator::errors_only()

Specifies that only error-level messages and non-document-error messages are reported (so that warnings and info messages are not reported)., (*16)

Werror

 $this|string Zsxsoft\W3CValidator\W3CValidator::Werror()

Makes the checker exit non-zero if any warnings are encountered (even if there are no errors)., (*17)

exit_zero_always

 $this|string Zsxsoft\W3CValidator\W3CValidator::exit_zero_always()

Makes the checker exit zero even if errors are reported for any documents., (*18)

filterfile

 $this|string Zsxsoft\W3CValidator\W3CValidator::filterfile()

Specifies a filename. Each line of the file contains either a regular expression or starts with "#" to indicate the line is a comment. Any error message or warning message that matches a regular expression in the file is filtered out (dropped/suppressed)., (*19)

filterpattern

 $this|string Zsxsoft\W3CValidator\W3CValidator::filterpattern()

Specifies a regular-expression pattern. Any error message or warning message that matches the pattern is filtered out (dropped/suppressed)., (*20)

format

 $this|string Zsxsoft\W3CValidator\W3CValidator::format()

Specifies the output format for reporting the results., (*21)

  • Default: json

skip_non_html

 $this|string Zsxsoft\W3CValidator\W3CValidator::skip_non_html()

Skip documents that don’t have *.html, *.htm, *.xhtml, or *.xht extensions., (*22)

html

 $this|string Zsxsoft\W3CValidator\W3CValidator::html()

Forces any *.xhtml or *.xht documents to be parsed using the HTML parser., (*23)

no_langdetect

 $this|string Zsxsoft\W3CValidator\W3CValidator::no_langdetect()

Disables language detection, so that documents are not checked for missing or mislabeled html[lang] attributes., (*24)

no_stream

 $this|string Zsxsoft\W3CValidator\W3CValidator::no_stream()

Forces all documents to be be parsed in buffered mode instead of streaming mode (causes some parse errors to be treated as non-fatal document errors instead of as fatal document errors)., (*25)

verbose

 $this|string Zsxsoft\W3CValidator\W3CValidator::verbose()

Specifies "verbose" output. (Currently this just means that the names of files being checked are written to stdout.), (*26)

version

 $this|string Zsxsoft\W3CValidator\W3CValidator::version()

Shows the vnu.jar version number., (*27)

License

The MIT License, (*28)

The Versions

03/12 2017

dev-master

9999999-dev

The PHP binding of vnu.jar (The Nu Html Checker)

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

The Development Requires

by Avatar zsx

03/12 2017

17.11.1.3

17.11.1.3

The PHP binding of vnu.jar (The Nu Html Checker)

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

The Development Requires

by Avatar zsx

30/10 2017

17.11.1.2

17.11.1.2

The PHP binding of vnu.jar (The Nu Html Checker)

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

The Development Requires

by Avatar zsx

29/10 2017

17.11.1.1

17.11.1.1

The PHP binding of vnu.jar (The Nu Html Checker)

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

The Development Requires

by Avatar zsx

10/10 2017

17.11.1.0

17.11.1.0

The PHP binding of vnu.jar (The Nu Html Checker) Edit

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

The Development Requires

by Avatar zsx