Skip to content

Plain data

phil/accessibility-statement

Statement::toArray() writes a statement as plain data, and StatementReader::fromArray() reads it back to the same statement. StatementReader::fromJson() reads the same data as JSON, up to 1 MiB and 16 levels deep. A configuration file, a database row or an API carries a statement this way.

use Phil\AccessibilityStatement\StatementReader;

$statement = StatementReader::fromArray([
    'version' => 2,
    'published_at' => '2026-11-08',
    'entity' => 'Example Org',
    'feedback' => ['email' => 'accessibility@example.com'],
    'non_conformities' => [
        ['criterion' => '1.4.3', 'description' => ['en' => 'Grey text on the event pages.']],
    ],
]);

$statement->status;     // ConformanceStatus::Partial, derived from the non-conformities
$statement->target;     // WCAG 2.2 AA, the default

The keys

KeyValueWhen left out
versioninteger from 1refused
published_atmomentrefused
standardwcag-2.0, wcag-2.1, wcag-2.2wcag-2.2
levelA, AA, AAAAA
statusfull, partial, non-conformantthe status the non-conformities support
entitystringnone
scopetextnone
feedbackmap: email, phone, url, postal_address (text), response_daysrefused
non_conformitieslist of maps: criterion (required, such as 1.4.3), reason (non-compliance by default, disproportionate-burden, out-of-scope), description, alternative (texts), fix_by (moment), occurrences (integer), from_audit (boolean)none
alternativeslist of textsnone
enforcementmap: procedure (text, required), authority (text), urlnone
evaluationmap: evaluated_at (moment, required), method (self-assessment by default, third-party, automated), pages, report_urlnone

A text is a map of language tags to strings: {"en": "…", "fr": "…"}. A moment is a date, 2026-11-08, read at midnight UTC, or a date and a time with its offset, 2026-11-08T10:00:00-05:00 or …Z; a relative moment such as tomorrow and a date that does not exist such as 2026-02-30 are refused.

toArray() leaves out what is not given: a null, an empty list, a zero, a false. It writes moments as 2026-11-08T10:00:00-05:00.

What is refused

An unknown key at any level, a value of the wrong type, a value out of its bounds or a statement that contradicts itself refuses the whole statement with an InvalidStatement: no statement is half read, and no warning is raised. The message names the key, as in The value of "level" is A, AA or AAA. or The feedback has no key "fax".