PHPackages                             steevanb/php-url-test - 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. steevanb/php-url-test

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

steevanb/php-url-test
=====================

Tests all urls of your application

0.3.3(5y ago)37275[2 issues](https://github.com/steevanb/php-url-test/issues)[3 PRs](https://github.com/steevanb/php-url-test/pulls)MITPHPPHP ^7.1

Since Apr 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/steevanb/php-url-test)[ Packagist](https://packagist.org/packages/steevanb/php-url-test)[ RSS](/packages/steevanb-php-url-test/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (27)Used By (0)

[![version](https://camo.githubusercontent.com/9060d599f3a45db025dbb7267b71b84cded8e234cfbd40f844f5240db9e8aabf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f616c7068612d302e332e332d7265642e737667)](https://github.com/steevanb/php-url-test/tree/0.3.3)[![Lines](https://camo.githubusercontent.com/993b902bc8ced8ca4f21a8b66911e3616cbc3ae56e2e6804b2bf7e43bfddc39e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64652532306c696e65732d343437392d677265656e2e737667)](https://camo.githubusercontent.com/993b902bc8ced8ca4f21a8b66911e3616cbc3ae56e2e6804b2bf7e43bfddc39e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64652532306c696e65732d343437392d677265656e2e737667)[![Total Downloads](https://camo.githubusercontent.com/948155262a1c867999163e3115a35630e01f2969e9bc2ff22fa6bc3ab49a9a53/68747470733a2f2f706f7365722e707567782e6f72672f7374656576616e622f7068702d75726c2d746573742f646f776e6c6f616473)](https://camo.githubusercontent.com/948155262a1c867999163e3115a35630e01f2969e9bc2ff22fa6bc3ab49a9a53/68747470733a2f2f706f7365722e707567782e6f72672f7374656576616e622f7068702d75726c2d746573742f646f776e6c6f616473)

php-url-test
------------

[](#php-url-test)

Tests all urls of your application

[![Url test](example.jpg)](example.jpg)

[Changelog](changelog.md)

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

[](#installation)

/!\\ Keep in mind this is an alpha version /!\\

Don't allow to update minor/bug fix versions, as we can break compatibility between bug fixes until final release.

```
composer require --dev steevanb/php-url-test 0.3.*
```

Use it with official Docker image
---------------------------------

[](#use-it-with-official-docker-image)

Instead of install it in your project with Composer, you can use official Docker image.

```
docker run \
    # Create a volume with your test configurations into /app
    -v /var/www/tests:/app \
    # You can use `URLTEST_PARAMETERS` env variable to add parameters to `urltest` command.
    -e URLTEST_PARAMETERS="--ansi --configuration=/app/urltest.yml -vvv" \
    # Allow this container to access host domains
    --net=host \
    steevanb/php-url-test:0.3.3
```

Launch tests
------------

[](#launch-tests)

```
# scan tests/ to find *.urltest.yml files, --recursive=false or -r=false to not do it recursively
# if urltest.yml file is found into tests/ (not in sub directories), it will be used for default configuration file
vendor/bin/urltest tests/

# test url_test_foo
vendor/bin/urltest tests/ url_test_foo

# test url_test_foo and all tests who match preg pattern /^url_test_bar[0..9]{1,}$/
vendor/bin/urltest tests/ url_test_foo,/^url_test_bar[0..9]{1,}$/

# launch tests from foo.urltest.yml only
vendor/bin/urltest tests/Tests/foo.urltest.yml

# don't use tests/urltest.yml, use another configuration file
# if you are a few developers with different domain for each developer,
# you can create a configuration file by developer and use parameters to configure it
vendor/bin/urltest tests/ --configuration=tests/foo.yml
```

Read test results and show informations
---------------------------------------

[](#read-test-results-and-show-informations)

```
# show only failed test comparison (by default), use -v, -vv or -vvv to get more informations
vendor/bin/urltest tests/ --reader=steevanb\\PhpUrlTest\\ResultReader\\ConsoleResultReader#error

# show only passed test comparison, use -v, -vv or -vvv to get more informations
vendor/bin/urltest tests/ --reader=steevanb\\PhpUrlTest\\ResultReader\\ConsoleResultReader#success
```

You can create your own ResultReader, by implementing *steevanb\\PhpUrlTest\\ResultReader\\ResultReaderInterface*.

Then you can use it as you use ConsoleResultReader, with `--reader` parameter.

You can separate readers by `,`:

```
vendor/bin/urltest tests/ --reader=steevanb\\PhpUrlTest\\ResultReader\\ConsoleResultReader#error,Foo\\Bar#success,Foo\\Baz
```

Stop on error and resume your tests
-----------------------------------

[](#stop-on-error-and-resume-your-tests)

You have 3 parameters to stop tests when a test fail, and resume tests from the one who fail, or skip it and continue after this one :

```
# stop when a test fail
vendor/bin/urltest tests/ --stop-on-error

# when a test fail, continue testing since the one who fail (do not re-test previous ones)
vendor/bin/urltest tests/ --stop-on-error --continue

# used with --continue, skip last fail test, and continue testing after this one (do not re-test previous ones)
vendor/bin/urltest tests/ --skip
```

\## Change directory where UrlTest could write files

```
vendor/bin/urltest tests/ --var-path=/foo
```

Dump configuration
------------------

[](#dump-configuration)

```
# dump only global configuration
vendor/bin/urltest --dump-configuration tests/

# dump global configuration, and url_test_foo configuration
vendor/bin/urltest --dump-configuration tests/ url_test_foo

# dump global configuration, url_test_foo configuration and all configurations who id match preg pattern /^url_test_bar[0..9]{1,}$/
vendor/bin/urltest --dump-configuration tests/ url_test_foo,/^url_test_bar[0..9]{1,}$/
```

YAML test file example
----------------------

[](#yaml-test-file-example)

Only *request.url* is required.

```
testId:
    # If abstract = true, this test will not be launched. you can use it as default configuration with parent: testId in another test
    abstract: false
    # Id of parent default configuration
    parent: ~
    # 0 is first. don't use negative numbers, it's used by UrlTest
    position: 0
    events:
        # Commands called before the test. it could be a string (for only one command) or an array of commands.
        beforeTest:
            - command
        # Commands called after the test. it could be a string (for only one command) or an array of commands.
        afterTest:
            - commands
    request:
        # You can use parameters (see above) to configure what you need
        url: '%domain%/foo'
        timeout: 30
        port: 80
        method: GET
        userAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
        referer: http://referer.com
        allowRedirect: true
        # List of headers to add to request
        headers:
            X-Foo: bar
    expectedResponse:
        url: http://test.dev
        code: 200
        size: 300
        contentType: text/html
        numConnects: 1
        # Set count if you know exaclty number of redirects you want to test, or min/max
        redirect:
            min: 1
            max: 1
            count: 1
        header:
            size: 200
            # List of headers who has to exists, and have exaclty this value
            headers:
                X-Foo: bar
            # List of headers should not exists
            unallowedHeaders:
                - X-Bar
        body:
            # Content to compare with response,  will get content of $fileName
            content:
            size: 100
            # Transformer id : transform data from content key before comparing it to response
            transformer: json
            # File name where tranformed expected content will be saved, if you need to test your transformer for example
            fileName: /tmp/urlTestResult/expectedResponse.html
    response:
        body:
            # Transformer id : transform data from response body before comparing it to expected response
            transformer: json
            # File name where response body will be saved
            fileName: /tmp/urlTestResult/response.html
```

You can define default configurations for all tests in your *.urltest.yml* file :

```
_defaults:
    # here you can define sames configurations as for a test
    # this configurations will be applied to all tests in this file, if value is not defined, null or ~
```

ResponseBodyTransformer
-----------------------

[](#responsebodytransformer)

A response body transformer will modify response body at 2 differents steps:

- `expectedResponse.body.transformer`: transform expected response
- `response.body.transformer`: transform response

List of available transformers:

- `json`: try to decode and reencode value, will transform response to null if data is not a valid JSON
- `uuid`: try to decode response (should be a valid JSON) and replace all UUID value by `____UUID____`

Create your own ResponseBodyTransformer
---------------------------------------

[](#create-your-own-responsebodytransformer)

To create your own ResponseBodyTransformer, you have to do this steps:

- Create a class who implement `steevanb\PhpUrlTest\ResponseBodyTransformer\ResponseBodyTransformerInterface`
- Register your ResponseBodyTransformer with `UrlTest::addResponseBodyTransformer()`

Global configuration file
-------------------------

[](#global-configuration-file)

You can define global configurations in *urltest.yml*.

This configurations will be applied to all tests.

```
# you can define tests here, or abstract tests to use it in all your tests
urltest:
    abstractTestId:
        abstract: true
        url: http://test.dev

# parameters can be used in almost all urltest configurations
# define it's value here, and use it with %parameterName% in your configuration
parameters:
    domain: 'http://foo.local'
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.3% 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 ~55 days

Recently: every ~65 days

Total

25

Last Release

2030d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e59638521a0ca6412cd2fa506834e384d4bac92197159891d4ccfe8e4b3d61eb?d=identicon)[steevanb](/maintainers/steevanb)

---

Top Contributors

[![steevanb](https://avatars.githubusercontent.com/u/5063383?v=4)](https://github.com/steevanb "steevanb (57 commits)")[![Julien-de-Farcy](https://avatars.githubusercontent.com/u/62881142?v=4)](https://github.com/Julien-de-Farcy "Julien-de-Farcy (1 commits)")

---

Tags

phpsymfony-console

### Embed Badge

![Health badge](/badges/steevanb-php-url-test/health.svg)

```
[![Health](https://phpackages.com/badges/steevanb-php-url-test/health.svg)](https://phpackages.com/packages/steevanb-php-url-test)
```

###  Alternatives

[phpro/grumphp

A composer plugin that enables source code quality checks.

4.3k16.7M1.0k](/packages/phpro-grumphp)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M560](/packages/shopware-core)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M729](/packages/sylius-sylius)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M504](/packages/pimcore-pimcore)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k60](/packages/open-dxp-opendxp)

PHPackages © 2026

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