Download the PHP package p1ho/accessibility-checker without Composer

On this page you can find all versions of the php package p1ho/accessibility-checker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package accessibility-checker

README

Build Status Coverage Status

Table of Content

Introduction

This is a 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

  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. 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 that there exists only 1 <h1> per page, by default the check for multiple <h1> 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

This package is available through Composer, and can be installed by entering:

Usage

configurations

Checker Name Parameters Parameters Description
Color 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 <h1>, heading_shift takes this into account (accepts a number from 0-6). strict_mode: if strict_mode is set to false, different headings like <h1> and <h2> can be nested at the same level, if set to true, <h2> would have to be nested deeper. allow_multiple_h1: defaults to false, if set to true, having more than 1 <h1> will not give any errors.
Image Accessibility Checker none none
Link 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:

Report Structure

In general, the reporting schematics will take the following structure:

Color Contrast Errors

Invalid Style Properties

Key Value
type one of ["invalid color", "invalid size", "invalid weight"]
property one of ["background-color", "color", "font-size", "font-weight"]
tag name of tag such as h1 or p
text text inside the tag (also texts from nested tags)
html raw html of the tag
recommendation "Fix the invalid <insert-property>."

Bad Color Contrast

Key Value
type "low contrast"
property "AA" or "AAA" (see WCAG 2.0 conformance levels)
tag name of tag such as h1 or p
text text inside the tag (also texts from nested tags)
html raw html of the tag
text_is_large whether the bolding level or size of text makes it a large font
contrast_ratio calculated contrast rounded to 2 decimal places (e.g. 1.23)
recommendation "Contrast Ratio for this element must be at least <insert-value>"

Heading Structure Errors

Heading Unallowed

Key Value
type "heading unallowed"
tag one of heading tags (e.g. h1)
text text inside the tag (also texts from nested tags)
html raw html of the tag
recommendation "Check and use only allowed headings (<insert-list-of-allowed-headings>)."

Heading Inside Heading

Key Value
type "heading inside heading"
tag one of heading tags (e.g. h1)
text text inside the tag (also texts from nested tags)
html raw html of the tag
recommendation "Do not put heading inside another heading."

Heading Skipped

Key Value
type "heading skipped"
tag one of heading tags (e.g. h1)
text text inside the tag (also texts from nested tags)
html raw html of the tag
recommendation If skipped h3, it would be "<h3> is expected before the placement of this heading."

Heading Too Shallow

Key Value
type "heading too shallow"
tag one of heading tags (e.g. h1)
text text inside the tag (also texts from nested tags)
html raw html of the tag
recommendation "Try nesting this heading deeper."

Heading Too Deep

Key Value
type "heading too deep"
tag one of heading tags (e.g. h1)
text text inside the tag (also texts from nested tags)
html raw html of the tag
recommendation "Try nesting this heading shallower."

Heading Misplaced

Key Value
type "heading misplaced"
tag one of heading tags (e.g. h1)
text text inside the tag (also texts from nested tags)
html raw html of the tag
recommendation "Try nesting this heading shallower."

Invalid Heading

Key Value
type "invalid heading"
tag one of heading tags (e.g. h1)
text text inside the tag (also texts from nested tags)
html raw html of the tag
recommendation "Use valid headings only (<h1> through <h6>).

Image Accessibility Errors

No Alt Text (Error)

Key Value
type "no alt"
src values inside src attribute
html raw html of the tag
recommendation "Add an alt attribute to the img and add a description."

Filename Alt Text (Error)

Key Value
type "filename alt"
src values inside src attribute
html raw html of the tag
recommendation "Do not use image filename as the alt attribute, describe the image."

Empty Alt Text (Warning)

Key Value
type "empty alt"
src values inside src attribute
html raw html of the tag
recommendation "If this image is integral to the content, please add a description."

Link Accessibility Errors

Redirect

Key Value
type "redirect"
href value inside href attribute
text text inside the tag (also texts from nested tags)
html raw html of the tag
recommendation "Use the final redirected link."

Dead

Key Value
type "dead"
href value inside href attribute
text text inside the tag (also texts from nested tags)
html raw html of the tag
recommendation "Find an alternative working link."

Domain Overlap

Key Value
type "domain overlap"
href value inside href attribute
text text inside the tag (also texts from nested tags)
html raw html of the tag
recommendation "Use relative URL."

Note: This is to make sure other pages in the same domain are linked via relative paths instead of absolute paths.

Slow Connection

Key Value
type "slow connection"
href value inside href attribute
text text inside the tag (also texts from nested tags)
html raw html of the tag
recommendation "Troubleshoot why the page takes so long to load."

Note: The checker uses the HEAD request to fetch meta data for a page, this should not take long; thus, if the checker times out after 5 seconds, the checker will deem the link as slow.

Poor Link Text

Key Value
type "poor link text"
href value inside href attribute
text text inside the tag (also texts from nested tags)
html raw html of the tag
recommendation "Use more descriptive and specific wording."

Note: at least 2/3 of the words in the text are in the black list.

Black List:

Url Link Text

Key Value
type "url link text"
href value inside href attribute
text text inside the tag (also texts from nested tags)
html raw html of the tag
recommendation "Use real words that describe the link."

Text Too Long

Key Value
type "bad text length"
href value inside href attribute
text text inside the tag (also texts from nested tags)
html raw html of the tag
recommendation "Ideal link text should be between 1 to 100 characters."

Note: The current limit is 100 characters.

Unclear PDF Link

Key Value
type "unclear pdf link"
href value inside href attribute
text text inside the tag (also texts from nested tags)
html raw html of the tag
recommendation "Include the word "PDF" in the link"

Unclear Download Link

Key Value
type "unclear download link"
href value inside href attribute
text text inside the tag (also texts from nested tags)
html raw html of the tag
recommendation "Include the word "download" in the link."

Development

Contributors

p1ho oburk

All versions of accessibility-checker with dependencies

PHP Build Version
Package Version
Requires stefangabos/zebra_curl Version ^1.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package p1ho/accessibility-checker contains the following files

Loading the files please wait ....