PHPackages                             p1ho/accessibility-checker - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. p1ho/accessibility-checker

AbandonedArchivedLibrary[Testing &amp; Quality](/categories/testing)

p1ho/accessibility-checker
==========================

Accessibility Testing Suite on raw HTML extracted from Content Management Systems

0.2.2(6y ago)36053MITPHP

Since Feb 20Pushed 6y ago2 watchersCompare

[ Source](https://github.com/p1ho/accessibility-checker)[ Packagist](https://packagist.org/packages/p1ho/accessibility-checker)[ Docs](https://github.com/p1ho/accessibility-checker)[ RSS](/packages/p1ho-accessibility-checker/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (4)Versions (6)Used By (0)

README
======

[](#readme)

[![Build Status](https://camo.githubusercontent.com/63da8ec2b036e5d1fa4da18b7c33415238490b258b2acc920a70b4e603379659/68747470733a2f2f7472617669732d63692e636f6d2f7031686f2f6163636573736962696c6974792d636865636b65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/p1ho/accessibility-checker)[![Coverage Status](https://camo.githubusercontent.com/0bf2865fd641f20617c064af6cbf963c23e17f561385e5f33fe70d32b3aa8d6f/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f7031686f2f6163636573736962696c6974792d636865636b65722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/p1ho/accessibility-checker?branch=master)

Table of Content
----------------

[](#table-of-content)

- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)
- [Report Structure](#report-structure)
    - [Color Contrast Errors](#color-contrast-errors)
    - [Heading Structure Errors](#heading-structure-errors)
    - [Image Accessibility Errors](#image-accessibility-errors)
    - [Link Accessibility Errors](#link-accessibility-errors)
- [Development](#development)
- [Contributors](#contributors)

Introduction
------------

[](#introduction)

This is a [Web Accessibility](https://en.wikipedia.org/wiki/Web_accessibility) testing suite that evaluates the HTML string extracted from Content Management Systems. This is not meant to be an exhaustive accessibility check, but it aims to bring severe accessibility issues to light, as well as generate awareness for accessibility in general.

Currently, this is being developed with the goal to analyze body texts from *Drupal Nodes*. However, algorithms used in these programs may be useful for developing a more general purpose solution.

Categories
----------

[](#categories)

1. **Color Contrast**: Since low color contrast can cause readability issues, this program will go through all the elements in the HTML and compare its text color with the background to see if its contrast level adheres to [WCAG 2.0 standard](https://www.w3.org/TR/WCAG/#contrast-minimum). Currently, it will only analyze inline styles, and will ignore the property 'opacity' due to the complexity it entails.
2. **Heading Structure**: For screen readers or other devices that do not render the page as the developers had intended, we owe it to them to make sure information on the page can be parsed correctly on their devices, too. Since Heading Structure (`` through ``) is pivotal in building the hierarchy for the page, this program will check if there are any headings that are skipped or misplaced. Additionally, because of the [recommendation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements) that there exists only 1 `` per page, by default the check for multiple `` will be on, but can be turned off.
3. **Image Accessibility**: We have to assume that people using the screen readers cannot see anything on the page (only hear it), and this includes pictures. Thus, images that are integral to the content must also contain a description in its 'alt' attribute. This program will raise errors for `` that do not have alt attributes and will raise warnings for `` that has an empty alt attribute (because it is possible for a picture to be there simply for aesthetics).
4. **Link Accessibility**: This checks 2 things: whether links are dead/unoptimized, and whether link texts are clear and descriptive. In particular, link text is also important for screen readers because usually there is an option to list all the links on a particular page; if all the links reads ***click here*** or ***more detail***, then it becomes impossible for the user to know whether the link is useful without actually accessing it. (In previous versions, HEAD requests were used; however, it turns out not all servers may implement HEAD requests correctly, or allow it at all, thus a regular GET request is used now, trading data size for consistency)

Installation
============

[](#installation)

This package is available through [Composer](https://getcomposer.org/), and can be installed by entering:

```
$ composer require p1ho/accessibility-checker
```

Usage
-----

[](#usage)

### configurations

[](#configurations)

Checker NameParametersParameters DescriptionColor Contrast Checker(optional)`mode`, (optional)`bg`, (optional)`color`**WCAG 2.0 Conformance**: "AA" or "AAA", defaults to "AA". **background-color**: any valid css value, defaults to "white". **color**: any valid css value, defaults to "black".Heading Structure Checker(optional)`heading_shift`, (optional)`strict_mode`, (optional)`allow_multiple_h1`**heading\_shift**: because CMS usually has a separate field for page title, the content part does not actually start at ``, `heading_shift` takes this into account (accepts a number from 0-6). **strict\_mode**: if `strict_mode` is set to `false`, different headings like `` and `` can be nested at the same level, if set to `true`, `` would have to be nested deeper. **allow\_multiple\_h1**: defaults to `false`, if set to true, having more than 1 `` will not give any errors.Image Accessibility CheckernonenoneLink Accessibility Checker(optional)`redirect_whitelist`**redirect\_whitelist**: some webpage will always redirect, those pages can be added into this whitelist so redirection checking is skipped.example:

```
