PDepend/PHPMD 2.0 and OXMD
PDepend/PHPMD 2.0 and OXMD
Roughly a week ago, PDepend and PHPMD (the PHP Mess Detector) reached its version 2.0 quite silently. I'd like to give a round up on the changes and how you can profit. In addition to that, Qafoo released OXMD together with Oxid eSales, a tool to check certifiaction cost and code quality issues in your Oxid eShop modules.
As a pure user of PDepend/PHPMD, there is not much change in the 2.0 version for you. There is now support for PHP 5.4/5.5 language constructs like the magic ::class constant, finally blocks and generators (yield). Beside that, there is bad news for PEAR, since support for its installer was dropped. However, both tools are now installable using either composer or by simply downloading a PHAR archive, which should suite all modern PHP projects quite well.
The most changes took place under the hood and motivated the release of a 2.0 version: The source code base for both tools is now much more developer friendly and allows you to implement extensions much easier. But of course, these changes broke backwards compatibility in the APIs everywhere. The most important changes for you as a developer are:
The source code of PDepend and PHPMD is now fully PSR2 compliant. As a result, most developers will find the code much easier to read, to extend and can easily include the code into their own project using composer. This will hopefully spawn some cool new projects that extend the functionality of PDepend/PHPMD.
In addition to this broad refactoring, both tools make now use of the Symfony2 dependency injection container to configure the application at run-time. As a precondition to this change, all remaining classes have been made capable of dependency injection. The result is again a much better integration with 3rd party code, allowing you to tweak the tools behavior by deriving their services.xml.
One project which already spawned out of the refactoring in direction of dependency injection is the OXMD tool, proudly presented by Qafoo and Oxid eSales in cooperation. OXMD allows Oxid eShop extension developers to check their modules for violations of the certification guidelines and to calculate the potential price for a module certification.
While OXMD does not use the dependency injection container of PHPMD directly, it was only possible to implement this tool in a clean way based on the changes required by the DI refactoring. Therefore, the tool can deal as a very good example for the potential unleashed for developers by the new version 2.0 of PDepend and PHPMD.
If you plan to create an extension for PDepend/PHPMD or want to integrate these tools into your own stack, please do not hesitate to contact us regarding expert developer resources. If you plan to provide your work under a compatible open source license, we can also offer you a good discount.
