php-mode 
- Description
- Major mode for editing PHP code
- Latest
- php-mode-1.26.1.0.20260805.106.tar (.sig), 2026-Aug-05, 860 KiB
- Maintainer
- USAMI Kenta <tadsan@zonu.me>
- Website
- https://github.com/emacs-php/php-mode
- Browse ELPA's repository
- CGit or Gitweb
- Badge
To install this package from Emacs, use package-install or list-packages.
Full description
PHP Mode is a major mode for editing PHP script. It's an extension of CC mode; thus it inherits all C mode's navigation functionality. But it colors according to the PHP syntax and indents according to the PSR-2 coding guidelines. It also includes a couple handy IDE-type features such as documentation search and a source and class browser. Please read the manual for setting items compatible with CC Mode. https://www.gnu.org/software/emacs/manual/html_mono/ccmode.html This mode is designed for PHP scripts consisting of a single <?php block. We recommend the introduction of Web Mode for HTML and Blade templates combined with PHP. http://web-mode.org/ Modern PHP Mode can be set on a project basis by .dir-locals.el. Please read php-project.el for details of directory local variables. If you are using a package manager, you do not need (require 'php-mode) in your ~/.emacs.d/init.el. Read the README for installation instructions. https://github.com/emacs-php/php-mode
Old versions
| php-mode-1.26.1.0.20260804.86.tar.lz | 2026-Aug-04 | 114 KiB |
| php-mode-1.26.1.0.20260724.81.tar.lz | 2026-Jul-24 | 112 KiB |
| php-mode-1.26.1.0.20260719.80.tar.lz | 2026-Jul-19 | 112 KiB |
| php-mode-1.26.1.0.20260715.58.tar.lz | 2026-Jul-15 | 99.6 KiB |
| php-mode-1.26.1.0.20260709.53.tar.lz | 2026-Jul-09 | 98.5 KiB |
| php-mode-1.26.1.0.20260702.44.tar.lz | 2026-Jul-02 | 97.5 KiB |
| php-mode-1.26.1.0.20251112.64638.tar.lz | 2025-Nov-12 | 97.3 KiB |
| php-mode-1.26.1.0.20241219.164506.tar.lz | 2024-Dec-19 | 96.9 KiB |
| php-mode-1.25.1.0.20240911.185503.tar.lz | 2024-Sep-11 | 95.5 KiB |
| php-mode-1.24.3.0.20230616.191943.tar.lz | 2023-Jun-16 | 101 KiB |
News
Changes for PHP Mode by Version
All notable changes of the PHP Mode 1.19.1 release series are documented in this file using the Keep a CHANGELOG principles.
Unreleased
Added
php-project-get-root-dirfalls back toproject-currentwhen no PHP-specific marker is found, soproject.elbackends (Projectile 3,project-vc-extra-root-markers, etc.) can contribute project detection- Add
php-ide-set-featurecommand to interactively enable a PHP-IDE feature for the current buffer- Only offers features whose backing package is actually available
- Add
php-ide-statuscommand to report the current PHP-IDE state for the current buffer- Shows whether it is on, what is configured, and what is available
- Add
php-ide-eglot-activate, which registersphp-ide-eglot-executableintoeglot-server-programs- Buffer-local, so only buffers that set the variable are affected; previously the variable had no effect on Eglot at all
Changed
- Add
readonlyclass modifier to [Imenu] ([#802]) - Add
enumsupport tophp-current-class([#802]) - Remove hardcoding of implicit paths in
phpthat are not guaranteed to exist ([#803]) php-ide-turn-onno longer errors whenphp-ide-featuresis unset- It is now a silent no-op, matching the README's
hack-local-variables-hookrecipe, which previously errored on every PHP file until a feature was configured
- It is now a silent no-op, matching the README's
php-ide-featuresnow also accepts a bare feature symbol, not just a list- This was already shown (but not actually supported) in
php-ide.el's own Commentary
- This was already shown (but not actually supported) in
- Restrict
:safeonphp-ide-features/php-ide-eglot-executable, and drop:safefromphp-ide-mode-functionsentirely- Previously these let a
.dir-locals.elsilently run an attacker-chosen command or Lisp function without Emacs's usual confirmation; now only PHP-IDE's own known feature symbols and bundled executable presets are accepted - If you now get prompted by a
.dir-locals.elyou wrote and trust yourself (e.g.php-ide-eglot-executableset to a raw path/command, or any use ofphp-ide-mode-functions), this is expected — PHP-IDE can no longer vouch for that value as safe. Answer!at the prompt to permanently remember that exact value (all supported Emacs versions), or+to trust the whole directory from then on (Emacs 30.1+); see(info "(emacs) Directory Variables"). You can also pre-approve values ahead of time in your own init file viasafe-local-variable-values/safe-local-variable-directories, so you are never prompted even on first visit. php-ide-mode-functionswas always meant to be configured globally withadd-hookin your init file (see the Commentary inphp-ide.el), not set per-project via.dir-locals.el. For per-project behavior, branch on theFEATUREargument inside your hook function instead of varying the variable's value by directory.
- Previously these let a
- Mark
php-ide-feature-alistandphp-ide-lsp-command-alistas risky local variables- They decide which command PHP-IDE executes and which functions it calls, and adding an entry to
php-ide-lsp-command-alistalso makes that entry pass the:safecheck ofphp-ide-eglot-executable— so a project could otherwise have supplied both the command and its own approval. Risky variables are always confirmed and never remembered as safe
- They decide which command PHP-IDE executes and which functions it calls, and adding an entry to
php-ide-modenow warns whenphp-ide-featuresenables more than one LSP client at once- Activation still proceeds; Phpactor's bridge is not an LSP client and pairs with one without a warning
- Make
php-ide-lsp-command-alistandphp-ide-eglot-managed-modescustomizable- Adding your own preset to
php-ide-lsp-command-alistis also how you let a project select that server from.dir-locals.elwithout confirming an executable path
- Adding your own preset to
- Narrow the "experimental" note in
php-ide.elto what it actually covers- The options and commands documented in the README are settled; what may still change is how a feature is described to PHP-IDE (the
php-ide-feature-alistentry keywords andphp-ide--...internals) ... ...
- The options and commands documented in the README are settled; what may still change is how a feature is described to PHP-IDE (the