NonGNU-devel ELPA - php-mode

php-mode Atom Feed

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.lz2026-Aug-04 114 KiB
php-mode-1.26.1.0.20260724.81.tar.lz2026-Jul-24 112 KiB
php-mode-1.26.1.0.20260719.80.tar.lz2026-Jul-19 112 KiB
php-mode-1.26.1.0.20260715.58.tar.lz2026-Jul-1599.6 KiB
php-mode-1.26.1.0.20260709.53.tar.lz2026-Jul-0998.5 KiB
php-mode-1.26.1.0.20260702.44.tar.lz2026-Jul-0297.5 KiB
php-mode-1.26.1.0.20251112.64638.tar.lz2025-Nov-1297.3 KiB
php-mode-1.26.1.0.20241219.164506.tar.lz2024-Dec-1996.9 KiB
php-mode-1.25.1.0.20240911.185503.tar.lz2024-Sep-1195.5 KiB
php-mode-1.24.3.0.20230616.191943.tar.lz2023-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-dir falls back to project-current when no PHP-specific marker is found, so project.el backends (Projectile 3, project-vc-extra-root-markers, etc.) can contribute project detection
  • Add php-ide-set-feature command to interactively enable a PHP-IDE feature for the current buffer
    • Only offers features whose backing package is actually available
  • Add php-ide-status command 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 registers php-ide-eglot-executable into eglot-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 readonly class modifier to [Imenu] ([#802])
  • Add enum support to php-current-class ([#802])
  • Remove hardcoding of implicit paths in php that are not guaranteed to exist ([#803])
  • php-ide-turn-on no longer errors when php-ide-features is unset
    • It is now a silent no-op, matching the README's hack-local-variables-hook recipe, which previously errored on every PHP file until a feature was configured
  • php-ide-features now 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
  • Restrict :safe on php-ide-features/php-ide-eglot-executable, and drop :safe from php-ide-mode-functions entirely
    • Previously these let a .dir-locals.el silently 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.el you wrote and trust yourself (e.g. php-ide-eglot-executable set to a raw path/command, or any use of php-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 via safe-local-variable-values / safe-local-variable-directories, so you are never prompted even on first visit.
    • php-ide-mode-functions was always meant to be configured globally with add-hook in your init file (see the Commentary in php-ide.el), not set per-project via .dir-locals.el. For per-project behavior, branch on the FEATURE argument inside your hook function instead of varying the variable's value by directory.
  • Mark php-ide-feature-alist and php-ide-lsp-command-alist as risky local variables
    • They decide which command PHP-IDE executes and which functions it calls, and adding an entry to php-ide-lsp-command-alist also makes that entry pass the :safe check of php-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
  • php-ide-mode now warns when php-ide-features enables 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-alist and php-ide-eglot-managed-modes customizable
    • Adding your own preset to php-ide-lsp-command-alist is also how you let a project select that server from .dir-locals.el without confirming an executable path
  • Narrow the "experimental" note in php-ide.el to 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-alist entry keywords and php-ide--... internals) ... ...