Next: PHP Comments, Previous: Editing, Up: Top
Completing function names, identifiers and keywords in PHP is possible in PHP mode. In PHP mode, it is possible to complete identifiers defined by PHP programming language, and functions defined by you.
For PHP mode to know the functions of keywords of PHP, it must have access to the PHP manual. Download the HTML archive of the manual made of separate files for each function.1 Unpack the files to a directory, and define the variable php-manual-path to the location of these files. Configure this setting with either M-x customize-variable RET php-manual-path RET, or by setting the value in your Emacs initialization file (~/.emacs). The PHP function names
For functions and classes you define, you'll need to provide them to Emacs as a tag file.2 Creating a tag file (TAGS) from a PHP source code file is done by running the etags command on the file.3 The etags command can even generate tag files for providing completion across multiple files. For larger projects and PHP coded libraries, use a system like a Makefile to generate and maintain the tag tables.
etags file
to create a tags file for file.
To generate a tag file for all the PHP files in the current directory, run
etags *.php
To enable a tags file you need to use the following command.
consider using the variable php-completion-file.
Configure this setting with either M-x customize-variable RET php-completion-file RET, or by setting the value in your Emacs initialization file (~/.emacs).
For larger projects or because of other specific needs, conventional ways of setting these and other variables may be inadequate. As of 2008, third-party packages do exist for Emacs to configure Emacs settings on groups of files or for directory trees, including dirvars.el.
php-complete-function).
php-show-arglist). The argument
list is generated by finding and jumping to the respective
function's location specified in the tag file (see above).
The argument list is then read and printed to the
minibuffer.
[1] http://www.php.net/download-docs.php
[2] See Tags Tables.
[3] See Creating Tags Tables.