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 $locator = new SourceLocator(__DIR__ . '/views'); foreach ($violations as $violation) { $location = $locator->locate($violation->htmlSnippet); if ($location) { $violation->location = $location; } } // Render Report (Format as results mapped by page URL) $reporter = new HtmlDashboardReporter(); $reportHtml = $reporter->render(['http://localhost:8080/index.php' => $violations], 'demo/index.php'); // Inject into body $html = str_replace('', $reportHtml . '', $html); } // 7. Output Final HTML echo $html;