Essential Packages

This is all you really need to get started. It adds syntax highlighting and sets
up indentation. It doesn't work so great for HTML formatting (especially when
mixing PHP/HTML), so I recommend using a dedicated mode for that (such as
web-mode below).

Note: The version on SourceForge is out of date. The fork from GitHub is still
maintained and is the version provided by melpa.

I only discovered this recently, but it's quickly become my favourite mode for
web development. The HTML support is great, and it also works well when editing
template languages such as Twig, Liquid or Ruby's erb format.

web-mode also provides a lot of keyboard shortcuts and adds functionality for
collapsing tags, renaming elements and navigating around a document quickly.

I use the following configuration, which makes web-mode the default mode for
editing templates used by the Zend and Symfony2 frameworks.

Adds snippet expansion to Emacs. Great for speeding up creation of boilerplate
code. Comes with a selection of snippets for about two-dozen languages,
although PHP is not one of them. However, it's easy to add your own snippets
and something like php-auto-yasnippets can generate snippet definitions for all
PHP functions.

Adds functionality for expanding a selection in semantic units. This comes in
handy when editing code, as you can expand a region to enclose the current if
block, or capture an entire function in just a few keystrokes. Emacs Rocks has
a great video about expand-region that shows just how useful this can be.

This is a great little extension that lets you execute HTTP requests from within
a buffer. The results are then shown in a new buffer (along with the HTTP
response headers), and any JSON or XML results will be nicely formatted as
well.

This is extremely useful when writing and debugging API's, and makes finding
problems a lot easier.

Useful keyboard commands

Emacs is not exactly short of keyboard commands, but there are a few that I find
myself using over and over again.

php-mode shortcuts

Command

What it does

C-.

Displays arguments for a method (requires a valid TAGS file)

C-c C-f

Searches the PHP manual for the keyword at the current point

web-mode shortcuts

Command

What it does

C-c C-f

Fold / unfold the current tag

C-c C-e r

Rename the current element, including its closing tag.

C-c C-i

Indent the entire buffer

C-c C-t b

Jump to beginning of the current tag

C-c C-t e

Jump to the end of the current tag

C-c /

Close the currently open tag

Running Phing

Emacs has the compile command that will run make in the current
directory. This isn't so great for PHP, but it's not too difficult to get it
working happily with something like Phing.

phing-call.el is based on Ant call. It will ask for a target name to execute,
and will then search the directory of the current file for a build.xml
file. If no build.xml is found, it will search in the parent
directory/directories until it finds one. The output will then be shown in a
buffer named *phing-compilation*.