idm / laravel-html-validator
Laravel package with service to validate HTML
Installs: 14
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/idm/laravel-html-validator
Requires
- php: >=7.2
- ext-curl: *
- illuminate/support: ^8.40
This package is auto-updated.
Last update: 2025-09-29 02:50:54 UTC
README
version: 1.0.0
Description:
Library for laravel to validate HTML by URL.
Install:
composer req idm/laravel-html-validator
Usage:
In your PHP-class (controller / service) just:
1. Use library (at the top in usage stage)
use IDM\LaravelHtmlValidator\Services\HtmlValidator;
2. Init it
$htmlValidator = new HtmlValidator;
3. Use it
Set the URL of page, which you want to validate:
$htmlValidator->setUrl($url);
Get link to validator:
$results = $htmlValidator->getLink();
Get validation results (array):
$results = $htmlValidator->validate();
Results:
[
'isValid' => .., // true / false,
'erros' => .., // number of errors
'warnings' => .., // number of warnings
'link' => .., // link to validator
'html' => .., // html response from validator
]
Config:
To publish library config to your project run:
php artisan vendor:publish
And select at list: IDM\LaravelHtmlValidator\ServiceProvider
Options in config:
[
// Base link to validator service
'validator_url' => 'https://validator.w3.org/unicorn/check',
// Validator task (used in making full link to validator)
'validator_task' => 'conformance',
// Count number of warnings or not
'ignore_warnings' => true,
// Return in results HTML response from validator
'return_html' => true
]
Requirements:
- PHP
- CURL
- Laravel