gemorroj / cssvalidator
W3C CSS Validator service.
Installs: 24 869
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 4
Forks: 1
Open Issues: 0
Requires
- php: >=8.0.2
- ext-dom: *
- ext-libxml: *
- symfony/http-client: ^5.4||^6.0||^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.41
- phpunit/phpunit: ^9.6
README
Requirements:
- PHP >= 8.0.2
Installation:
composer require gemorroj/cssvalidator
Example:
<?php use CSSValidator\CSSValidator; $validator = new CSSValidator(); $result = $validator->validateFragment('#css-code { background: green; }'); $result = $validator->validateFile('/path/to/file.css'); $result = $validator->validateUri('http://example.com/style.css'); $result = $validator->validateUri('http://example.com'); // extract and validate all CSS files on that page echo $result->getCssLevel(); var_dump($result->isValid()); print_r($result->getErrors()); print_r($result->getWarnings());