PHPackages                             pem-fr/phpwtf - 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. pem-fr/phpwtf

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

pem-fr/phpwtf
=============

This tool allows for silent human code reviews on -any language- source file, with reports usable in jenkins for example.

901[4 issues](https://github.com/PEM-FR/phpwtf/issues)[1 PRs](https://github.com/PEM-FR/phpwtf/pulls)PHP

Since Jul 27Pushed 5y ago4 watchersCompare

[ Source](https://github.com/PEM-FR/phpwtf)[ Packagist](https://packagist.org/packages/pem-fr/phpwtf)[ RSS](/packages/pem-fr-phpwtf/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

phpwtf
======

[](#phpwtf)

What is it?
-----------

[](#what-is-it)

You know Pdepend, PHPMD? well it's a WTF counter for PHP, useful for codereviews The concept is simple, when you review some code, if you think :

- WTF!?
- Why? Why? Why!!!

You simply add a @wtf\_start and @wtf\_stop as a comment before and after the code that needs explanations or fixing. PHPWTF will parse the code and report the wtfs it finds. Ideally we could even make it usable by Jenkins with a nice graph and code exploration :)

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

[](#installation)

/!\\ THIS TOOL IS TO BE INSTALLED WITH COMPOSER :

**if you already know how to use composer you can skip this part and go to Usage section.**

Basically you need to:

1. Create a directory where you want to run your composer install, ie : phpwtf\_test
2. Download the composer.phar into your phpwtf\_test folder
3. Create a composer.json file in the phpwtf\_test folder like :
    ```
    {
    	"name": "nameOfYourProject",
    	"minimum-stability": "dev",
    	"require": {
    		"php": ">=5.3.3",
    		"pem-fr/phpwtf": "dev-master"
    	}
    }
    ```
4. Then, still from the phpwtf\_test folder, run this command line : php composer.phar install
5. Verify that in the root folder (in our example phpwtf\_test) you have a composer.lock file and a vendor directory.
6. Congratulations you have installed phpwtf through composer :)

Usage
-----

[](#usage)

To run the example, you just need to :

1. Go to where you installed phpwtf, in the root folder then type in your console :
    ```
    php vendor/bin/phpwtf review --paths="./vendor/phpwtf/phpwtf/examples/*.php,./vendor/phpwtf/phpwtf/examples/*.js,./vendor/phpwtf/phpwtf/examples/*.html" -r --format=html --output-path="../reports/"
    ```
2. Now you should see in your root folder, a reports directory with the html reports

Of course phptwtf script supports help command

Args can be written like that :

```
php vendor/bin/phpwtf.php review --paths="path/.php,path/.js" --format=html --output-path="path/to/reports/" -r -b
```

This list of options is non-exhaustive and can change anytime. You can use the help or list command to have more up to date information at any time. Also note that since they are all options, they can be put in *any* order.

```
--input-path    -p      Paths to scan for sources,
                            ie: "/some/path/*.php,/some/other/path/*.js"
                            Default to "/". Becareful, relative path are resolved
                            from either vendor folder or root folder if you
                            have not installed phpwtf with composer.

--recursive     -r      If set, the paths will be scanned recursively. Defaults to *FALSE*

--format        -f      by default xml, can be set to html, html+stats, xml+stats
                            the xml is a simple xml with files, and errors
                            the html is a set of pages per file, with the errors
                            reported + stats stats will just ouput statistics
                            about the nb of WTF, etc
                            finally you can combine output format by using "+"

--output-path   -o      defaults to ./reports/
                            the directory where you want your reports to be written

--skip-error    -s      if set, errors will not stop the parsing.

--bench         -b      To display timings.

```

What more?
----------

[](#what-more)

Accepting contributions (jenkins integration, code exploration, graphs, better parsing...) :)

The Logo and favicon are courtesy of David Smith and under MIT Licence of the phpwtf project.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance11

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/09cee1d2989730fb713b599aa637fc56dfd6e1b3095c9838761f02addedfa204?d=identicon)[PEM](/maintainers/PEM)

---

Top Contributors

[![PEM-FR](https://avatars.githubusercontent.com/u/623084?v=4)](https://github.com/PEM-FR "PEM-FR (10 commits)")

### Embed Badge

![Health badge](/badges/pem-fr-phpwtf/health.svg)

```
[![Health](https://phpackages.com/badges/pem-fr-phpwtf/health.svg)](https://phpackages.com/packages/pem-fr-phpwtf)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)

PHPackages © 2026

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