Emacs is just as good for PHP. Why VIM? Why not.
Basic PHP development in VIM is obviously no problem: we have highlighting, we have indenting - but what are the options when we want to get serious?
Here's a list of plugins I found especially useful.
- Syntax checking
- checksyntax:
provides syntax checking for PHP, (La)TeX and Ruby. Note that you'll need
display_errorsset tostderrin php.ini for this to work. - Folding
- phpfolding: What it says, and it Just Works.
- Documenting
-
This is a bit more complicated. First you need to decide on a documenting system. phpDocumentor and Doxygen seem to be the most widely used. phpDocumentor is obviously written specifically for PHP, but it feels sluggish - though that's just my opinion. Doxygen is originally written for C and C++, but PHP shares much of it's syntax with them, so that's a non-issue.
For phpDocumentor there are several plugins. I found PDV (PHP Documentor for Vim) the nicest. It lets you insert comment blocks with a shortcut, and extracts as much as possible from the definition (name, visibility, arguments).
Same goes for Doxygen. DoxygenToolkit is (like Doxygen itself) written for C/C++/Java, but it gets things right in PHP most of the time. Doxygen-via-Doxygen looks promising: it uses Doxygen to actually generate the comments. Elegant. I can't comment on quality though, haven't tried it myself (download an XSLT processor, set up the XSLT file, I'm tired for that now).
- Highlight MySQL
-
Serious PHP usually means a database, and some kind of SQL at that - so why
not syntax-highlight the SQL code? Yeah, I know, it looks funny inside
strings, but I like it - YMMV. One: you need SQL highlighting in sql files (you
most likely already have that). Two: stick the following line somewhere it gets executed
(I put it in ~/.vim/ftplugin/php/custom.vim):
let php_sql_query = 1
Additional suggestions are welcome. Not out of courtesy, I genuinely am interested.