PHPackages                             phildaiguille/twig-a11y-rules - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. phildaiguille/twig-a11y-rules

ActiveLibrary[Templating &amp; Views](/categories/templating)

phildaiguille/twig-a11y-rules
=============================

Accessibility linting rules for Twig templates

0.7.0(1mo ago)117MITPHPPHP &gt;=8.2CI passing

Since Apr 26Pushed 1w agoCompare

[ Source](https://github.com/PhilDaiguille/twig-a11y-rules)[ Packagist](https://packagist.org/packages/phildaiguille/twig-a11y-rules)[ RSS](/packages/phildaiguille-twig-a11y-rules/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (8)Dependencies (7)Versions (9)Used By (0)

twig-a11y-rules
===============

[](#twig-a11y-rules)

> Accessibility linting rules for Twig templates, built on top of [`vincentlanglet/twig-cs-fixer`](https://github.com/VincentLanglet/Twig-CS-Fixer).

[![Latest Stable Version](https://camo.githubusercontent.com/21d8b3526bbc39e63c827106953f9acf74615cc3643e22847d43f04c9c9d62e3/687474703a2f2f706f7365722e707567782e6f72672f7068696c6461696775696c6c652f747769672d613131792d72756c65732f76)](https://packagist.org/packages/phildaiguille/twig-a11y-rules) [![Total Downloads](https://camo.githubusercontent.com/43a98ef8877c19878cf3234b1b0ab3b9c2116259b14f1dd19a5392c64202c1ff/687474703a2f2f706f7365722e707567782e6f72672f7068696c6461696775696c6c652f747769672d613131792d72756c65732f646f776e6c6f616473)](https://packagist.org/packages/phildaiguille/twig-a11y-rules) [![Latest Unstable Version](https://camo.githubusercontent.com/1080a1e9cd46f4054e7fa8f600f19df13c95cdee67784bc8199c74f7758a2c0a/687474703a2f2f706f7365722e707567782e6f72672f7068696c6461696775696c6c652f747769672d613131792d72756c65732f762f756e737461626c65)](https://packagist.org/packages/phildaiguille/twig-a11y-rules) [![License](https://camo.githubusercontent.com/a7d4a60506e402c4e8d9ba4d0b7aa3cc063247675033f385e1adb3a93fd0a57a/687474703a2f2f706f7365722e707567782e6f72672f7068696c6461696775696c6c652f747769672d613131792d72756c65732f6c6963656e7365)](https://packagist.org/packages/phildaiguille/twig-a11y-rules) [![PHP Version Require](https://camo.githubusercontent.com/7bde63f0d8dde41eb49aff4cc90dfcd3c24579a6700d148c2a823a98f2f9830b/687474703a2f2f706f7365722e707567782e6f72672f7068696c6461696775696c6c652f747769672d613131792d72756c65732f726571756972652f706870)](https://packagist.org/packages/phildaiguille/twig-a11y-rules)[![CI](https://github.com/PhilDaiguille/twig-a11y-rules/workflows/Tests/badge.svg)](https://github.com/PhilDaiguille/twig-a11y-rules/actions?query=workflow%3ATests)[![codecov](https://camo.githubusercontent.com/1dd5e680dd26df86a536b8b793129a54554fb9600da24aa95b821a24907f98bb/68747470733a2f2f636f6465636f762e696f2f67682f5068696c4461696775696c6c652f747769672d613131792d72756c65732f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d43574b3254383332354a)](https://codecov.io/gh/PhilDaiguille/twig-a11y-rules)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#----)

What is this?
-------------

[](#what-is-this)

`twig-a11y-rules` is a standalone package of accessibility rules for Twig templates. It integrates with `twig-cs-fixer` and statically checks your templates for known accessibility issues — missing `alt` attributes, empty buttons, invalid ARIA roles, and more.

> **Note:** Static analysis cannot guarantee full accessibility. Manual testing remains essential.

Inspired by [Deque's Axe Linter](https://axe-linter.deque.com/) and built as a modern successor to the unmaintained [`nielsdeblaauw/twigcs-a11y`](https://github.com/nielsdeblaauw/twigcs-a11y).

---

Requirements
------------

[](#requirements)

- PHP &gt;= 8.2
- [`vincentlanglet/twig-cs-fixer`](https://packagist.org/packages/vincentlanglet/twig-cs-fixer) &gt;= 3.0

---

Installation
------------

[](#installation)

```
composer require --dev phildaiguille/twig-a11y-rules vincentlanglet/twig-cs-fixer
```

This package provides rules only — it does not expose its own binary. Use the `twig-cs-fixer` binary to run linting.

---

Usage
-----

[](#usage)

Create a `.twig-cs-fixer.php` configuration file at the root of your project:

```
