composer require "twentyua/html-validator-bundle"
Add the bundle to your AppKernel.php:
new \TwentyUa\HtmlValidatorBundle\TwentyUaHtmlValidatorBundle(),
Not additional configuration is needed.
$container->get('twentyua_htmlvalidator.validator')->isMarkupValid($html);