Next: , Previous: Top, Up: Top


1 Introduction

PHP mode is a major mode for editing PHP source code in Emacs. As an extension of Emacs's C mode, it inherits all C mode's navigation and editing functionality. Syntax elements of PHP source code is colored according to the grammar of PHP versions 3, 4 and 5. By default, the indent rules follow the PHP PEAR coding guidelines. Additional aids for developing in PHP include documentation search of the PHP manual, code completion and a class browser.

To find out what version of PHP mode you have installed run M-x php-mode-version.

PHP mode was first released in 1999 and was written by Turadg Aleahmad. At the time of PHP mode's initial release, version 2 of PHP (PHP/FI) was only 2 years old and the release of PHP 3 had happened the year before. In May of 2000, PHP 4 was released. Subsequent versions of PHP mode scurried to support the quickly evolving syntax of this emerging programming language.

In 2001, PHP mode became a SourceForge project and version 1.0 was released later that year. Further refinements of the Emacs library included improvements to the syntax coloring rules, portability between XEmacs and GNU Emacs, integration of various development tools available in various Emacsen.

PHP mode's support for PHP 5 first appeared in 2004, the same year PHP 5 was released. 2004 was the last year Aleahmad made a release. In 2005, Lennart Borgman combined a forked version of PHP mode with his “new XML mode for Emacs” (nXhtml). The stalled development of PHP resulted in people sharing various patches and improvements to PHP mode over the Internet.

The 1.4 release in 2008 represented a renewed commitment to the Emacs Lisp library with the addition of considerable updates and improvements – the first in over 2 years.

This manual describes PHP mode for practiced Emacs users especially those who have read or can refer to the Emacs manual. The reader should already know how to program in PHP, although one could easily learn how to program PHP using PHP mode and Emacs. There are no explanations of PHP programming in this manual.