PHPackages                             thecodingmachine/washingmachine - 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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. thecodingmachine/washingmachine

ActiveProject[DevOps &amp; Deployment](/categories/devops)

thecodingmachine/washingmachine
===============================

CI tool that integrates with Gitlab to show variations in the CRAP index

v1.2.0(9y ago)22144.2k1[4 issues](https://github.com/thecodingmachine/washingmachine/issues)MITPHP

Since Feb 10Pushed 7y ago5 watchersCompare

[ Source](https://github.com/thecodingmachine/washingmachine)[ Packagist](https://packagist.org/packages/thecodingmachine/washingmachine)[ RSS](/packages/thecodingmachine-washingmachine/feed)WikiDiscussions 2.0 Synced yesterday

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

[![Latest Stable Version](https://camo.githubusercontent.com/647c3d99d572677d318674bad988f45a1c275a1f86b54d315e9adaacd70d0082/68747470733a2f2f706f7365722e707567782e6f72672f746865636f64696e676d616368696e652f77617368696e676d616368696e652f762f737461626c65)](https://packagist.org/packages/thecodingmachine/washingmachine)[![Total Downloads](https://camo.githubusercontent.com/ccb9921efb8473a2f2d2c2d46e965b5d73c6ecde4fe964a725936d1ce62c0471/68747470733a2f2f706f7365722e707567782e6f72672f746865636f64696e676d616368696e652f77617368696e676d616368696e652f646f776e6c6f616473)](https://packagist.org/packages/thecodingmachine/washingmachine)[![Latest Unstable Version](https://camo.githubusercontent.com/c8fa40eb7246d54ca57f147db4877105a40c5a9f7b0ccdcc7936e869ee750d51/68747470733a2f2f706f7365722e707567782e6f72672f746865636f64696e676d616368696e652f77617368696e676d616368696e652f762f756e737461626c65)](https://packagist.org/packages/thecodingmachine/washingmachine)[![License](https://camo.githubusercontent.com/ab6813a67a8d6b8dc190bc32b0dbe7610c48f8b947fea81e56fdc12248127c4a/68747470733a2f2f706f7365722e707567782e6f72672f746865636f64696e676d616368696e652f77617368696e676d616368696e652f6c6963656e7365)](https://packagist.org/packages/thecodingmachine/washingmachine)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7c64ddeb6887c41e13d5835f1912d7b35d8acc2910b1e385443578d99a62d118/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f746865636f64696e676d616368696e652f77617368696e676d616368696e652f6261646765732f7175616c6974792d73636f72652e706e673f623d322e30)](https://scrutinizer-ci.com/g/thecodingmachine/washingmachine/?branch=2.0)[![Build Status](https://camo.githubusercontent.com/3804ddfe54ca54c5c68fa157480ce55bb4dfb40a113d7e434e5b47e36923a999/68747470733a2f2f7472617669732d63692e6f72672f746865636f64696e676d616368696e652f77617368696e676d616368696e652e7376673f6272616e63683d322e30)](https://travis-ci.org/thecodingmachine/washingmachine)[![Coverage Status](https://camo.githubusercontent.com/2f57c485e2e286ab8444894dee85c3333a1a158150b68123e2472649d151649b/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f746865636f64696e676d616368696e652f77617368696e676d616368696e652f62616467652e7376673f6272616e63683d322e3026736572766963653d676974687562)](https://coveralls.io/github/thecodingmachine/washingmachine?branch=2.0)

Washing machine
===============

[](#washing-machine)

The *washing machine* is a tool that helps you writing cleaner code by integrating PHPUnit with Gitlab CI.

As a result, when you perform a merge request in Gitlab, the washing machine will add meaningful information about your code quality.

Usage
-----

[](#usage)

### Enable Gitlab CI for your project

[](#enable-gitlab-ci-for-your-project)

First, you need a Gitlab project with continuous integration enabled (so a project with a `.gitlab-ci.yml` file).

### Create a personal access token

[](#create-a-personal-access-token)

Then, you need a [Gitlab API personal access token](https://docs.gitlab.com/ce/api/README.html#personal-access-tokens).

Got it?

### Add a secret variable

[](#add-a-secret-variable)

Now, we need to add this token as a "secret variable" of your project (so the CI script can modify the merge request comments):

Go to your project page in Gitlab

**Settings ➔ CI/CD Pipelines ➔ Secret Variables**

- Key: `GITLAB_API_TOKEN`
- Value: the token you just received in previous step

### Configure PHPUnit to dump a "clover" test file

[](#configure-phpunit-to-dump-a-clover-test-file)

Let's configure PHPUnit. Go to your `phpunit.xml.dist` file and add:

```

```

Note: the "clover.xml" file must be written at the root of your GIT repository, so if your `phpunit.xml.dist` sits in a subdirectory, the correct path will be something like "../../clover.xml".

Alternatively, washing-machine also knows how to read Crap4J files. Crap4J files contain Crap score, but not code coverage score so you will get slightly less data from Crap4J. The expected file name is "crap4j.xml".

### Configure Gitlab CI yml file

[](#configure-gitlab-ci-yml-file)

Now, we need to install the *washingmachine*, and get it to run.

`.gitlab-ci.yml`

```
image: php:7.1

test:
  before_script:
   - cd /root && composer create-project thecodingmachine/washingmachine washingmachine ^2.0

  script:
   - phpdbg -qrr vendor/bin/phpunit

  after_script:
   - /root/washingmachine/washingmachine run -v

```

Notice that we need to make sure the PHPDbg extension for PHP is installed. Also, make sure that Xdebug is NOT enabled on your Docker instance. Xdebug can also return code coverage data but is less accurate than PHPDbg, leading to wrong CRAP score results.

### Supported Gitlab versions

[](#supported-gitlab-versions)

- The washingmachine v2.0+ has support for Gitlab 9+.

If you seek support for older Gitlab versions, here is a list of supported Gitlab versions by washingmachine version:

- The washingmachine v1.0 =&gt; v1.2 has support for Gitlab 8.
- The washingmachine v1.2+ has support for Gitlab 8 and up to Gitlab 9.5.

### Adding extra data in the comment

[](#adding-extra-data-in-the-comment)

When the *washingmachine* adds a comment in your merge-request, you can ask it to add additional text. This text must be stored in a file.

You simply do:

```
washingmachine run -f file_to_added_to_comments.txt

```

Of course, this file might be the output of a CI tool.

The *washingmachine* will only display the first 50 lines of the file. If the file is longer, a link to download the file is added at the end of the comment.

You can also add several files by repeating the "-f" option:

```
washingmachine run -f file1.txt -f file2.txt

```

### Opening an issue

[](#opening-an-issue)

When a merge request is open, the *washingmachine* will post comments directly in the merge request.

If no merge request exists, the *washingmachine* can open an issue in your Gitlab project.

To open an issue, use the `--open-issue` option:

```
washingmachine run --open-issue

```

Tip: you typically want to add the `--open-issue` tag conditionally if a build fails. Also, the `--open-issue` is ignored if a merge request matches the build.

### Adding comments in commits

[](#adding-comments-in-commits)

The washingmachine can add comments directly in the commits (in addition to adding comments in the merge request).

To add comments in commits, use the `--add-comments-in-commits` option:

```
washingmachine run --add-comments-in-commits

```

Note: this option was enabled by default in 1.x and has to be manually enabled in 2.x. For each comment, a mail is sent to the committer. This can generate a big number of mails on big commits. You have been warned :)

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 97% 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 ~34 days

Recently: every ~113 days

Total

17

Last Release

2882d ago

Major Versions

v0.1.3 → 1.0.x-dev2017-02-22

1.3.x-dev → 2.0.x-dev2018-08-10

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1104771?v=4)[mouf](/maintainers/mouf)[@Mouf](https://github.com/Mouf)

![](https://avatars.githubusercontent.com/u/1847918?v=4)[TheCodingMachine](/maintainers/thecodingmachine)[@thecodingmachine](https://github.com/thecodingmachine)

---

Top Contributors

[![moufmouf](https://avatars.githubusercontent.com/u/1290952?v=4)](https://github.com/moufmouf "moufmouf (130 commits)")[![lowtower](https://avatars.githubusercontent.com/u/426242?v=4)](https://github.com/lowtower "lowtower (4 commits)")

---

Tags

cigitlabgitlab-ciphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/thecodingmachine-washingmachine/health.svg)

```
[![Health](https://phpackages.com/badges/thecodingmachine-washingmachine/health.svg)](https://phpackages.com/packages/thecodingmachine-washingmachine)
```

###  Alternatives

[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

103519.9k45](/packages/friendsoftypo3-content-blocks)[rector/rector-src

Instant Upgrade and Automated Refactoring of any PHP code

136406.3k14](/packages/rector-rector-src)[api-platform/openapi

Models to build and serialize an OpenAPI specification.

404.2M83](/packages/api-platform-openapi)[symfony/ux-translator

Exposes Symfony Translations directly to JavaScript.

26735.1k7](/packages/symfony-ux-translator)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M534](/packages/shopware-core)[aeliot/todo-registrar

Register TODOs from source code in issue tracker

153.0k](/packages/aeliot-todo-registrar)

PHPackages © 2026

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