I use emacs as IDE, and wanted to have direct feedback about the validity of my .php files when writing them. The most easy way was to add a save hook that runs PHP_CodeSniffer - but the results should be displayed in a nice, unobtrusive way.
phpcs has multiple reporting modes - xml, checkstyle, csv etc. - but nothing for the desktop. I thought that notify-send would be the right fit since it is able to display pretty popup messages without getting in the way.
So I hacked a bit and send a pull request to Greg that got merged today. So in the next version of PHP_CodeSniffer, you will be able to enjoy it, too!
So when running
$ phpcs --report=notifysend file.php
you will see something along this:
emacs integration
The integration into emacs is pretty simple. Just put the following into your .emacs file:
Using M-x phpcs-notifysend, you'll run the check immediately. Running it automatically when a file gets saved isn't hard either:
Alternatives
Hans-Peter Buniat told me about his tool Testy which runs unit tests and has many options to notify you about the results - including notify-send, dbus and Growl. It could be started from within emacs, too.
Comments? Please send an e-mail.