Probably the most useful thing I’ve done as a PHP developer is to add mappings to run the current file through (a) the PHP interpreter (using Ctrl-M), and (b) the PHP interpreter’s linter (using Ctrl-L). These are accomplished with the following:
" run file with PHP CLI (CTRL-M) :autocmd FileType php noremap <C-M> :w!<CR>:!$HOME/bin/php %<CR> " PHP parser check (CTRL-L) :autocmd FileType php noremap <C-L> :!$HOME/bin/php -l %<CR>
(I have ~/bin/php as my PHP interpreter, which allows me to run PHP with a custom config file, as well as to change which PHP binary I’m using.)
These two commands allow me to quickly and easily check that my syntax is okay, as well as to run unit test suites easily.