PHPackages                             kolyunya/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. [Testing &amp; Quality](/categories/testing)
4. /
5. kolyunya/codeception-markup-validator

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

kolyunya/codeception-markup-validator
=====================================

Markup validator module for Codeception.

5.0.0(3y ago)1413.8k9[1 issues](https://github.com/Kolyunya/codeception-markup-validator/issues)[1 PRs](https://github.com/Kolyunya/codeception-markup-validator/pulls)3LGPL-3.0-or-laterPHPPHP &gt;=8.1 &lt;9.0

Since Apr 22Pushed 3y ago2 watchersCompare

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

READMEChangelogDependencies (5)Versions (11)Used By (3)

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

[](#codeception-markup-validator)

[![Latest Stable Version](https://camo.githubusercontent.com/214b8101cc2da292b8a040010547ae0052424862610ffa8b45c3cfd5b5f43131/68747470733a2f2f706f7365722e707567782e6f72672f6b6f6c79756e79612f636f646563657074696f6e2d6d61726b75702d76616c696461746f722f762f737461626c65)](https://packagist.org/packages/kolyunya/codeception-markup-validator)[![Build Status](https://github.com/Kolyunya/codeception-markup-validator/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/Kolyunya/codeception-markup-validator/actions/workflows/build.yml)[![PHPStan](https://camo.githubusercontent.com/441b5874ce4df0a2defc892979c96c46889b69cb32119d04f0b48626349f8bc9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d656e61626c65642d627269676874677265656e2e7376673f7374796c653d666c6174)](https://github.com/phpstan/phpstan)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/1a0bba326d1aedc3c98170ad65fe0bc47abd82f43eed60690f36c91b037c7601/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4b6f6c79756e79612f636f646563657074696f6e2d6d61726b75702d76616c696461746f722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Kolyunya/codeception-markup-validator/?branch=master)[![Code Climate](https://camo.githubusercontent.com/b96717d9748f7e42d3e0d9f7323eb88b55d67a4a1286bc965bff56a73178f3d3/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f4b6f6c79756e79612f636f646563657074696f6e2d6d61726b75702d76616c696461746f722f6261646765732f6770612e737667)](https://codeclimate.com/github/Kolyunya/codeception-markup-validator)

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 --dev kolyunya/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

43

—

FairBetter than 91% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity87

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 100% 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 ~235 days

Recently: every ~529 days

Total

10

Last Release

1192d 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.0 → 5.0.02023-02-12

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

4.0.0PHP &gt;=5.6 &lt;8.0

5.0.0PHP &gt;=8.1 &lt;9.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2682768?v=4)[Nick Oleynikov](/maintainers/Kolyunya)[@Kolyunya](https://github.com/Kolyunya)

---

Top Contributors

[![Kolyunya](https://avatars.githubusercontent.com/u/2682768?v=4)](https://github.com/Kolyunya "Kolyunya (130 commits)")

---

Tags

acceptance-testingcodeceptioncodeception-modulehtml-validatormarkup-validatorw3c-validatorcodeceptionacceptance-testingcodeception-modulehtml-validatormarkup-validatorw3c-validator

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[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)[lucatume/wp-browser

A set of Codeception modules to test WordPress projects.

6343.8M153](/packages/lucatume-wp-browser)[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)[codeception/module-symfony

Codeception module for Symfony framework

949.4M95](/packages/codeception-module-symfony)

PHPackages © 2026

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