PHPackages                             mattsmithdev/codeception-markup-validator - 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. mattsmithdev/codeception-markup-validator

ActiveLibrary

mattsmithdev/codeception-markup-validator
=========================================

Markup validator module for Codeception.

5.0.3(3y ago)11.9kLGPL-3.0-or-laterPHPPHP &gt;=5.6

Since Apr 22Pushed 3y agoCompare

[ Source](https://github.com/dr-matt-smith/codeception-markup-validator)[ Packagist](https://packagist.org/packages/mattsmithdev/codeception-markup-validator)[ Docs](https://github.com/dr-matt-smith/codeception-markup-validator)[ RSS](/packages/mattsmithdev-codeception-markup-validator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (13)Used By (0)

Codeception Markup Validator
============================

[](#codeception-markup-validator)

NOTE - fork of out of date existing project
-------------------------------------------

[](#note---fork-of-out-of-date-existing-project)

This is based on minor updates from the following package (which seems to no longer be supported). I've created this fork so my students can use this library with modern PHP 8.0 / 8.1.

-

Problem
-------

[](#problem)

Programmatically validate markup of web application pages during automated acceptance testing.

Solution
--------

[](#solution)

Markup validator module for [Codeception](http://codeception.com). Validates web-pages markup (HTML, XHTML etc.) using markup validators e.g. [W3C Markup Validator Service](https://validator.w3.org/docs/api.html). Don't let invalid pages reach production. Add some zero effort tests to your acceptance suite which will immediately inform you when your markup gets broken.

```
$I->amOnPage('/');
$I->validateMarkup();
```

Dead simple to use. Requires literally no configuraton. Works as you expect it out of box. Fully configurable and extendable if you want to hack it. Each component of the module can be replaced with your custom class. Just implement a simple interface and inject custom component to the module.

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

[](#installation)

The recommended way of module installation is via [composer](https://getcomposer.org):

```
composer require mattsmithdev/codeception-markup-validator
```

Usage
-----

[](#usage)

Add the module to your acceptance test suit configuration:

```
class_name: AcceptanceTester
modules:
    enabled:
        - PhpBrowser:
            url: 'http://localhost/'
        - Kolyunya\Codeception\Module\MarkupValidator
```

Build the test suit:

```
codecept build
```

Validate markup:

```
$I->amOnPage('/');
$I->validateMarkup();
```

If you need, you may override module-wide message filter configuration for each page individually like this:

```
// Perform very strict checks for this particular page.
$I->amOnPage('/foo/');
$I->validateMarkup(array(
    'ignoreWarnings' => false,
));

// Ignore those two errors just on this page.
$I->amOnPage('/bar/');
$I->validateMarkup(array(
    'ignoredErrors' => array(
        '/some error/',
        '/another error/',
    ),
));

// Set error count threshold, do not ignore warnings
// but ignore some errors on this page.
$I->amOnPage('/quux/');
$I->validateMarkup(array(
    'errorCountThreshold' => 10,
    'ignoreWarnings' => false,
    'ignoredErros' => array(
        '/this error/',
        '/that error/',
    ),
));
```

Configuration
-------------

[](#configuration)

The module does not require any configuration. The default setup will work if you have either [`PhpBrowser`](http://codeception.com/docs/modules/PhpBrowser) or [`WebDriver`](http://codeception.com/docs/modules/WebDriver) modules enabled.

Nevertheless the module is fully-configurable and hackable. It consist of four major components: [`provider`](https://github.com/Kolyunya/codeception-markup-validator/blob/master/sources/Lib/MarkupValidator/MarkupProviderInterface.php) which provides markup to validate, [`validator`](https://github.com/Kolyunya/codeception-markup-validator/blob/master/sources/Lib/MarkupValidator/MarkupValidatorInterface.php) which performs actual markup validation, [`filter`](https://github.com/Kolyunya/codeception-markup-validator/blob/master/sources/Lib/MarkupValidator/MessageFilterInterface.php) which filters messages received from the validator and [`printer`](https://github.com/Kolyunya/codeception-markup-validator/blob/master/sources/Lib/MarkupValidator/MessagePrinterInterface.php) which determines how to print messages received from the validator. You may configure each of the components with a custom implementation.

### Provider

[](#provider)

The module may be configured with a custom `provider` which will provide the markup to the `validator`. The [`default provider`](https://github.com/Kolyunya/codeception-markup-validator/blob/master/sources/Lib/MarkupValidator/DefaultMarkupProvider.php) tries to obtain markup from the `PhpBrowser` and `WebDriver` modules.

```
class_name: AcceptanceTester
modules:
    enabled:
        - PhpBrowser:
            url: 'http://localhost/'
        - Kolyunya\Codeception\Module\MarkupValidator:
            provider:
                class: Acme\Tests\Path\To\CustomMarkupProvider
```

### Validator

[](#validator)

The module may be configured with a custom `validator` which will validate markup received from the `provider`. The [default validator](https://github.com/Kolyunya/codeception-markup-validator/blob/master/sources/Lib/MarkupValidator/W3CMarkupValidator.php) uses the [W3C Markup Validation Service API](https://validator.w3.org/docs/api.html).

```
class_name: AcceptanceTester
modules:
    enabled:
        - PhpBrowser:
            url: 'http://localhost/'
        - Kolyunya\Codeception\Module\MarkupValidator:
            validator:
                class: Acme\Tests\Path\To\CustomMarkupValidator
```

### Filter

[](#filter)

The module may be configured with a custom `filter` which will filter messages received from the `validator`. You may implement you own `filter` or tweak a [default one](https://github.com/Kolyunya/codeception-markup-validator/blob/master/sources/Lib/MarkupValidator/DefaultMessageFilter.php).

```
class_name: AcceptanceTester
modules:
    enabled:
        - PhpBrowser:
            url: 'http://localhost/'
        - Kolyunya\Codeception\Module\MarkupValidator:
            filter:
                class: Kolyunya\Codeception\Lib\MarkupValidator\DefaultMessageFilter
                config:
                    errorCountThreshold: 10
                    ignoreWarnings: true
                    ignoredErrors:
                        - '/some error/'
                        - '/another error/'
```

### Printer

[](#printer)

The module may be configured with a custom `printer` which defines how messages received from the `validator` are printed. The [default printer](https://github.com/Kolyunya/codeception-markup-validator/blob/master/sources/Lib/MarkupValidator/DefaultMessagePrinter.php) prints message type, summary, details, first line number, last line number and related markup.

```
class_name: AcceptanceTester
modules:
    enabled:
        - PhpBrowser:
            url: 'http://localhost/'
        - Kolyunya\Codeception\Module\MarkupValidator:
            printer:
                class: Acme\Tests\Path\To\CustomMessagePrinter
```

Contributing
------------

[](#contributing)

If you found a bug or have a feature request feel free to [open an issue](https://github.com/Kolyunya/codeception-markup-validator/issues/new). If you want to send a pull request, backward-compatible changes should target the `master` branch while breaking changes - the next major version branch.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 93.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~191 days

Recently: every ~315 days

Total

12

Last Release

1212d ago

Major Versions

1.0.3 → 2.0.02017-04-27

2.0.0 → 3.0.02017-04-28

3.1.0 → 4.0.02020-08-23

4.0.1 → 5.0.12023-01-19

PHP version history (4 changes)1.0.0PHP &gt;=5.4 &lt;8.0

4.0.0PHP &gt;=5.6 &lt;8.0

4.0.1PHP &gt;=5.6 &lt;8.2

5.0.1PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ae5a872d27445abd90dd3972feaf090688537736bda9b28054d4aa4fedf5ef2?d=identicon)[mattsmithdev](/maintainers/mattsmithdev)

---

Top Contributors

[![Kolyunya](https://avatars.githubusercontent.com/u/2682768?v=4)](https://github.com/Kolyunya "Kolyunya (128 commits)")[![dr-matt-smith](https://avatars.githubusercontent.com/u/1216855?v=4)](https://github.com/dr-matt-smith "dr-matt-smith (9 commits)")

---

Tags

codeceptionacceptance-testingcodeception-modulehtml-validatormarkup-validatorw3c-validator

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mattsmithdev-codeception-markup-validator/health.svg)

```
[![Health](https://phpackages.com/badges/mattsmithdev-codeception-markup-validator/health.svg)](https://phpackages.com/packages/mattsmithdev-codeception-markup-validator)
```

###  Alternatives

[kolyunya/codeception-markup-validator

Markup validator module for Codeception.

1413.8k3](/packages/kolyunya-codeception-markup-validator)[codeception/module-webdriver

WebDriver module for Codeception

3831.4M245](/packages/codeception-module-webdriver)[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15511.5M30](/packages/magento-magento2-functional-testing-framework)[codeception/module-phpbrowser

Codeception module for testing web application over HTTP

6529.8M508](/packages/codeception-module-phpbrowser)[codeception/module-asserts

Codeception module containing various assertions

8550.6M1.2k](/packages/codeception-module-asserts)[codeception/lib-innerbrowser

Parent library for all Codeception framework modules and PhpBrowser

8641.7M77](/packages/codeception-lib-innerbrowser)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
