How To Install elpa-php-mode on Debian 11

In this tutorial we learn how to install elpa-php-mode on Debian 11. elpa-php-mode is PHP Mode for GNU Emacs

Introduction

In this tutorial we learn how to install elpa-php-mode on Debian 11.

What is elpa-php-mode

elpa-php-mode is:

This project updates PHP Mode for GNU Emacs with features that make it more friendly to use with PHP 5.4 and later. Web Mode should be used in preference to PHP Mode when one needs to work with PHP scripts that contain HTML and other markup. Supports:

  • Highlighting for keywords, for all official PHP magic and predefined constants, for PHPDoc tags and annotations, and for customised user-defined lists of frequently used constants.
  • Imenu listings for traits, interfaces, namespaces, and anonymous functions.
  • Syntax highlighting, including fontification of namespaces.
  • Chained Method Calls that align method calls over multiple lines anchored around the ‘->’ operator.
  • Prettified formatting of arrays and nested function calls.
  • On-the-fly syntax checking via Flycheck or Flymake.
  • Searching PHP documentation using key at point (under cursor).
  • Executing Regions of PHP. Output appears in the PHP buffer.
  • Multiple coding styles. In addition to its default style, this mode supports Drupal, WordPress, Symfony2, and PEAR/PSR-2.
  • Amaka. PHP Mode activates when editing build scripts.
  • Most of PSR-5: PHPDoc (Draft).

There are three methods to install elpa-php-mode on Debian 11. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install elpa-php-mode Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install elpa-php-mode using apt-get by running the following command:

sudo apt-get -y install elpa-php-mode

Install elpa-php-mode Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install elpa-php-mode using apt by running the following command:

sudo apt -y install elpa-php-mode

Install elpa-php-mode Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install elpa-php-mode using aptitude by running the following command:

sudo aptitude -y install elpa-php-mode

How To Uninstall elpa-php-mode on Debian 11

To uninstall only the elpa-php-mode package we can use the following command:

sudo apt-get remove elpa-php-mode

Uninstall elpa-php-mode And Its Dependencies

To uninstall elpa-php-mode and its dependencies that are no longer needed by Debian 11, we can use the command below:

sudo apt-get -y autoremove elpa-php-mode

Remove elpa-php-mode Configurations and Data

To remove elpa-php-mode configuration and data from Debian 11 we can use the following command:

sudo apt-get -y purge elpa-php-mode

Remove elpa-php-mode configuration, data, and all of its dependencies

We can use the following command to remove elpa-php-mode configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge elpa-php-mode

Dependencies

elpa-php-mode have the following dependencies:

References

Summary

In this tutorial we learn how to install elpa-php-mode package on Debian 11 using different package management tools: apt, apt-get and aptitude.