addRule(new ImgAltText()); $scanner->addRule(new FormLabel()); $scanner->addRule(new \YakNet\AccessibilityConsole\Rules\HtmlHasLang()); $scanner->addRule(new \YakNet\AccessibilityConsole\Rules\EmptyLink()); // Scan the captured HTML $violations = $scanner->scan($html); if (!empty($violations)) { // Locate Sources // We point it to the 'views' directory so it knows where to look for the error source $locator = new SourceLocator(__DIR__ . '/views'); foreach ($violations as $violation) { $location = $locator->locate($violation->snippet); if ($location) { $violation->setSourceLocation($location['file'], $location['line']); } } // Render Report $reporter = new HtmlReporter(); $reportHtml = $reporter->render($violations); // Inject into body $html = str_replace('', $reportHtml . '', $html); } // 7. Output Final HTML echo $html;