I dived into the code of my new favorite IDE Netbeans these last days and came up with an extension module, which adds PHP CodeSniffer Support on a per file basis to make my life much easier. It shows warnings and errors as annotations to the Editor and marks the affected lines in yellow and red.
My Java skills being very bad, it will only work on Linux currently, since the PHP Code Sniffer "binary" is hardcoded into the Java Source code. You have to create a "/usr/bin/phpcs2" executable, which is a wrapper that looks like:
With Manuals extensions (see the comments) the module now works without the wrapper script. It might even work under Windows now. Yet now the Zend Coding standard is enforced though. I am working on making that one configurable next.
You can install the NBM module install file from the GitHub repository into Netbeans and it "should" work then.
I hope to get more familiar with Netbeans in the future to add some more PHP tools and enhance Code Sniffer support.



robo47
Jul, 31. 2009
Really great. Thx for the great work.
Since the .nbm didn't work in 6.7.1 and in the latest 6.8 nightly, I build it myself in 6.7.1 from the git master (50ee09a6caf88e9b1e69a4896122363677e87c68), but in the latest 6.8 nightly netbeans seems to miss org.netbeans.modules.php.project.util.PhpProgram;
Current Problem running it on 6.7.1:
After running it once on a file, then changing something, running it again doesn't change any annotations.
A new "code-check" is only possible after restarting netbeans.
But it's really great to have phpcs IN netbeans :)
after phpunit in netbeans, netbeans is really getting better for php-development from day to day.