PHPackages                             mi-schi/phpmd-symfony2 - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. mi-schi/phpmd-symfony2

Abandoned → [https://github.com/mi-schi/phpmd-extension](/?search=https%3A%2F%2Fgithub.com%2Fmi-schi%2Fphpmd-extension)ArchivedLibrary[Validation &amp; Sanitization](/categories/validation)

mi-schi/phpmd-symfony2
======================

Extended mess detection rules from phpmd for Symfony applications.

2.1.1(10y ago)3387.2k↓37.5%21MITPHP

Since Jun 30Pushed 9y ago4 watchersCompare

[ Source](https://github.com/mi-schi/phpmd-symfony2)[ Packagist](https://packagist.org/packages/mi-schi/phpmd-symfony2)[ Docs](https://github.com/mi-schi/phpmd-symfony2)[ RSS](/packages/mi-schi-phpmd-symfony2/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (21)Used By (1)

[![Use phpmd-extension instead.](https://camo.githubusercontent.com/14a8e7234bd98508cfd9903b34d873f772f8bad5efc410eddd157e9561fa51e6/687474703a2f2f7777772e7265706f7374617475732e6f72672f6261646765732f6c61746573742f6162616e646f6e65642e737667)](https://github.com/mi-schi/phpmd-extension)

phpmd-symfony2
==============

[](#phpmd-symfony2)

[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/0f6edb1a7dc1a21e79a55b7ed067c0ae0e8fbad066bf943d7c798f3a55312bcb/68747470733a2f2f7472617669732d63692e6f72672f6d692d736368692f7068706d642d73796d666f6e79322e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mi-schi/phpmd-symfony2)[![Build Status](https://camo.githubusercontent.com/63066cb86a21336afcb0e60d8779e2f69a1e4635d17649c75d6fcacfadfb2fbe/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d692d736368692f7068706d642d73796d666f6e79322f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mi-schi/phpmd-symfony2/build-status/master)[![Code Coverage](https://camo.githubusercontent.com/16fffd0970df54489db89ddf8a084b6da949573b16b00d5fe19ddbf61cfbf218/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d692d736368692f7068706d642d73796d666f6e79322f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mi-schi/phpmd-symfony2/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/ecc07d3f6eda866a794aacf8b8cfaba4fc128e5d0f44bc24f1461ff2505b1fd1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d692d736368692f7068706d642d73796d666f6e79322f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mi-schi/phpmd-symfony2/?branch=master)[![Dependency Status](https://camo.githubusercontent.com/befbee631ed11cebbd441b65001cc57c55a74d50ba3a271ef2dcd240e4680488/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3535363035346163363334646161333066623030313135642f62616467652e7376673f7374796c653d666c6174)](https://www.versioneye.com/user/projects/556054ac634daa30fb00115d)[![Latest Stable Version](https://camo.githubusercontent.com/c7e908e212aa76f1227446f5a6faeda54d07fc1440ebd56ebc832d1d97a9bd13/68747470733a2f2f706f7365722e707567782e6f72672f6d692d736368692f7068706d642d73796d666f6e79322f762f737461626c65)](https://packagist.org/packages/mi-schi/phpmd-symfony2)[![Total Downloads](https://camo.githubusercontent.com/5dce85c309a6454c052a71f92f452ce785322508735484f299efc84c6ea1f9f5/68747470733a2f2f706f7365722e707567782e6f72672f6d692d736368692f7068706d642d73796d666f6e79322f646f776e6c6f616473)](https://packagist.org/packages/mi-schi/phpmd-symfony2)[![SensioLabsInsight](https://camo.githubusercontent.com/fc797e75789eb633a0a263a3130af973014b02a79ce1812f877e6aa55a9aee02/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f38393264303261322d356535652d346234652d623264332d6565303836656466626437382f736d616c6c2e706e67)](https://insight.sensiolabs.com/projects/892d02a2-5e5e-4b4e-b2d3-ee086edfbd78)

Features
--------

[](#features)

Extends phpmd with rules for Symfony2. Also add extra rules from clean code.

- Clean Code
    - [ClassNameSingleResponsibility](https://github.com/mi-schi/phpmd-symfony2/blob/master/Rulesets/cleancode.xml#L15-L18)
    - [MethodOneTryCatch](https://github.com/mi-schi/phpmd-symfony2/blob/master/Rulesets/cleancode.xml#L47)
    - [SuperfluousComment](https://github.com/mi-schi/phpmd-symfony2/blob/master/Rulesets/cleancode.xml#L97-L100)
    - [InlineIf](https://github.com/mi-schi/phpmd-symfony2/blob/master/Rulesets/cleancode.xml#L157-L158)
    - [MeaninglessMethodName](https://github.com/mi-schi/phpmd-symfony2/blob/master/Rulesets/cleancode.xml#L180-L182)
    - [TraitPublicMethod](https://github.com/mi-schi/phpmd-symfony2/blob/master/Rulesets/cleancode.xml#L211-L214)
    - [SwitchStatement](https://github.com/mi-schi/phpmd-symfony2/blob/master/Rulesets/cleancode.xml#L247-L251)
- Symfony2
    - [ControllerMethodName](https://github.com/mi-schi/phpmd-symfony2/blob/master/Rulesets/symfony2.xml#L14-L16)
    - [EntitySimpleGetterSetter](https://github.com/mi-schi/phpmd-symfony2/blob/master/Rulesets/symfony2.xml#L45-L48)
    - [EntityConstants](https://github.com/mi-schi/phpmd-symfony2/blob/master/Rulesets/symfony2.xml#L99-L101)
    - [ConstructorNewOperator](https://github.com/mi-schi/phpmd-symfony2/blob/master/Rulesets/symfony2.xml#L135-L138)
- Tests
    - [MethodNumberOfMocks](https://github.com/mi-schi/phpmd-symfony2/blob/master/Rulesets/test.xml#L14-L17)
    - [MethodNumberOfAsserts](https://github.com/mi-schi/phpmd-symfony2/blob/master/Rulesets/test.xml#L56-L58)
    - [MethodNameUnderstandable](https://github.com/mi-schi/phpmd-symfony2/blob/master/Rulesets/test.xml#L98-L99)

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

[](#installation)

Composer is used for installation. Add the following lines to your `composer.json` file:

```
"require-dev": {
    "mi-schi/phpmd-symfony2": "^2.0"
}

```

Usage
-----

[](#usage)

Create a `phpmd.xml` file and import the basic rules from phpmd. The example below contains some useful changes. Afterwards you can extend the configuration with rules from this repository.

### Basic Rules

[](#basic-rules)

```

    mess detection

```

### Add extra rules

[](#add-extra-rules)

```

```

You can also customize the rules with own properties or use only specific rules. Just take a look in the xml files. It works as the basic ruleset logic.

ToDos
-----

[](#todos)

- Rule against Train Wreck (getFoo()-&gt;getBar()-&gt;getMuh()-&gt;getMeh())
- Rule for high cohesion (member variables are used by a lot of methods)
- Rule that a service should never call a controller
- Try to avoid "return $this-&gt;doSomething() &amp;&amp; !$this-&gt;doOtherthings()"

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 97.8% 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 ~16 days

Recently: every ~57 days

Total

20

Last Release

3661d ago

Major Versions

1.1.8 → 2.0.02015-09-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/b21f249f3d6ec2961e46ff81b9093caf83a33b659eeeaecda0038e6cff0384d4?d=identicon)[mi-schi](/maintainers/mi-schi)

---

Top Contributors

[![mi-schi](https://avatars.githubusercontent.com/u/8821732?v=4)](https://github.com/mi-schi "mi-schi (134 commits)")[![akovalyov](https://avatars.githubusercontent.com/u/2339101?v=4)](https://github.com/akovalyov "akovalyov (1 commits)")[![cedricziel](https://avatars.githubusercontent.com/u/418970?v=4)](https://github.com/cedricziel "cedricziel (1 commits)")[![tommy-muehle](https://avatars.githubusercontent.com/u/1351840?v=4)](https://github.com/tommy-muehle "tommy-muehle (1 commits)")

---

Tags

phpmdmess detectionSymfony2rulesextendsclean code

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mi-schi-phpmd-symfony2/health.svg)

```
[![Health](https://phpackages.com/badges/mi-schi-phpmd-symfony2/health.svg)](https://phpackages.com/packages/mi-schi-phpmd-symfony2)
```

###  Alternatives

[mi-schi/phpmd-extension

Contains extra phpmd rules from clean code book and the best practices of my experiences.

40882.0k5](/packages/mi-schi-phpmd-extension)[ruler/ruler

A simple stateless production rules engine for modern PHP.

1.1k794.6k3](/packages/ruler-ruler)[suin/php-cs-fixer-rules

A Rule set for PHP-CS-Fixer mainly targeting PHP 7.1 or higher.

13116.7k3](/packages/suin-php-cs-fixer-rules)[hybridlogic/validation

A simple, extensible validation library for PHP with support for filtering and validating any input array along with generating client side validation code.

641.1k](/packages/hybridlogic-validation)

PHPackages © 2026

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