playwright-php/accessibility

Accessibility testing for Playwright PHP using axe-core. Check web pages for WCAG compliance.

Fund package maintenance!
smnandre

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/playwright-php/accessibility

v1.0.0 2025-11-08 13:43 UTC

This package is auto-updated.

Last update: 2026-02-13 20:00:06 UTC


README

Playwright PHP

  PHP Version   CI   Release   License

Playwright PHP - Accessibility

Perform real accessibility audits on web pages using Playwright PHP and axe-core,
checking for WCAG, ARIA, color contrast, and best-practice compliance.

Installation

This package relies on Playwright PHP - to install it, follow the instructions in Playwright PHP’s installation guide.

composer require --dev playwright-php/accessibility

Usage

Basic Analysis

use Playwright\Accessibility\AxeBuilder;

$builder = new AxeBuilder($page);
$results = $builder->analyze();

if ($results->hasViolations()) {
    foreach ($results->violations as $violation) {
        echo "{$violation->id}: {$violation->help}\n";
    }
}

PHPUnit Integration

use Playwright\Accessibility\AssertsAccessibility;

class MyTest extends TestCase
{
    use AssertsAccessibility;

    public function testPageIsAccessible(): void
    {
        $page->goto('https://example.com');
        $this->assertIsAccessible($page);
    }
}

Advanced Configuration

// Scope to specific regions
$builder->within('#main-content')->analyze();

// Filter by WCAG level
$builder->withTags([WcagTag::WCAG_2_1_AA])->analyze();

// Disable specific rules
$builder->withoutRules([RuleId::COLOR_CONTRAST])->analyze();

// Exclude elements
$builder->exclude('.advertisement')->analyze();

License

This package is released by the Playwright PHP project under the MIT License. See the LICENSE file for details.