Alexander-Miller/company-shell@a77f4de759 -> Alexander-Miller/company-shell@5f959a63a6 Emacs-Kotlin-Mode-Maintainers/kotlin-mode@3e0c34087b -> Emacs-Kotlin-Mode-Maintainers/kotlin-mode@fddd747e5b FStarLang/fstar-mode.el@c95c2a61a6 -> FStarLang/fstar-mode.el@ab0697b947 Fuco1/sphinx-mode@9d4075c106 -> Fuco1/sphinx-mode@77ca51adf9 Groovy-Emacs-Modes/groovy-emacs-modes@bf732d367b -> Groovy-Emacs-Modes/groovy-emacs-modes@c612ac1e9f Khady/merlin-eldoc@db7fab1edd -> Khady/merlin-eldoc@bf8edc63d8 OVYA/php-cs-fixer@7e12a1af5d -> OVYA/php-cs-fixer@efe4368d89 ProofGeneral/PG@e1e29acb04 -> ProofGeneral/PG@8416875696 Wilfred/elisp-def@dfca043ec0 -> Wilfred/elisp-def@1d2e88a232 agda/agda@b612cabaae -> agda/agda@bb7603d197 amake/flutter.el@08138f8c95 -> amake/flutter.el@edd3f5eb3f ananthakumaran/exunit.el@0715c2dc2d -> ananthakumaran/exunit.el@e0a8c2b81f beancount/beancount-mode@ea8257881b -> beancount/beancount-mode@519bfd868f bradyt/dart-mode@3bac14200f -> bradyt/dart-mode@9c846769ab brantou/emacs-go-tag@59b243f2fa -> brantou/emacs-go-tag@33f2059551 cdominik/cdlatex@8e963c6853 -> cdominik/cdlatex@ac024ce293 clojure-emacs/cider@92c1b6de20 -> clojure-emacs/cider@1ed5163433 clojure-emacs/clj-refactor.el@db89b55871 -> clojure-emacs/clj-refactor.el@b5abe655e5 clojure-emacs/clojure-mode@414157c3e5 -> clojure-emacs/clojure-mode@3453cd229b cpitclaudel/company-coq@a6e349e013 -> cpitclaudel/company-coq@5affe7a96a crystal-lang-tools/emacs-crystal-mode@96a8058205 -> crystal-lang-tools/emacs-crystal-mode@9bfb9f0f56 davazp/graphql-mode@9740e4027b -> davazp/graphql-mode@1437b79006 diml/utop@bbd9a6ed45 -> diml/utop@ace481388a dominikh/go-mode.el@3273fcece5 -> dominikh/go-mode.el@166dfb1e09 elixir-editors/emacs-elixir@e0d0466d83 -> elixir-editors/emacs-elixir@7641373f05 emacs-csharp/csharp-mode@856ecbc0a7 -> emacs-csharp/csharp-mode@02c61c219b emacs-ess/ESS@39eba28300 -> emacs-ess/ESS@8b4664e4a7 emacs-lsp/lsp-dart@fda433671f -> emacs-lsp/lsp-dart@3db9f93c83 emacs-lsp/lsp-java@0968038b9a -> emacs-lsp/lsp-java@dbe448a886 emacs-lsp/lsp-sourcekit@f877659bab -> emacs-lsp/lsp-sourcekit@468c641e35 emacs-php/composer.el@7c7f89df22 -> emacs-php/composer.el@5af1707fef emacs-php/php-mode@5f26bec865 -> emacs-php/php-mode@fb11df8268 emacs-php/phpactor.el@34195f1533 -> emacs-php/phpactor.el@9440005814 emacs-php/psysh.el@21250984ad -> emacs-php/psysh.el@796b26a5cd emacs-straight/auctex@830e40a063 -> emacs-straight/auctex@3929d5408b emacs-straight/csv-mode@43f6106f0d -> emacs-straight/csv-mode@d190a479b4 emacs-straight/rainbow-mode@949166cc01 -> emacs-straight/rainbow-mode@8e96388fb4 emacs-straight/sml-mode@0338e9729b -> emacs-straight/sml-mode@5426ff4738 emacsmirror/auctex-latexmk@4d35352265 -> emacsmirror/auctex-latexmk@b00a95e6b3 emacsmirror/paredit@e4a67f4f23 -> emacsmirror/paredit@9a2c4b37fc emacsorphanage/macrostep@424e3734a1 -> emacsorphanage/macrostep@75ecd04121 erlang/otp@9ba9f6e60d -> erlang/otp@be7109f43b ethereum/emacs-solidity@20fb77e089 -> ethereum/emacs-solidity@ddb4a901c3 factor/factor@1aeafdb87b -> factor/factor@76ac65649d fsharp/emacs-fsharp-mode@c1e58c61f9 -> fsharp/emacs-fsharp-mode@09fec6c91f fxbois/web-mode@efa853e5cf -> fxbois/web-mode@df97ab62c9 godotengine/emacs-gdscript-mode@4badcf6a0c -> godotengine/emacs-gdscript-mode@d392e8aa7e greghendershott/racket-mode@af9b760e7b -> greghendershott/racket-mode@947d9806ee hhvm/hack-mode@a522f61c08 -> hhvm/hack-mode@26f06ffe82 idris-hackers/idris-mode@65d6db1b75 -> idris-hackers/idris-mode@c96f45d1b8 immerrr/lua-mode@5a9bee8d5f -> immerrr/lua-mode@ad639c62e3 iyefrat/evil-tex@0fa85c3fc8 -> iyefrat/evil-tex@3e0a26b91a jcollard/elm-mode@d4e434fa18 -> jcollard/elm-mode@5797500d74 joaotavora/sly@4513c382f0 -> joaotavora/sly@fa70fc8ab1 jorgenschaefer/emacs-buttercup@ceedad5efa -> jorgenschaefer/emacs-buttercup@07a52c9969 jrblevin/markdown-mode@1f709778ac -> jrblevin/markdown-mode@c765b73b37 jschaf/powershell.el@ce1f0ae0b2 -> jschaf/powershell.el@f2da15857e jwiegley/emacs-async@c78bab7506 -> jwiegley/emacs-async@71cc50f27f leanprover/lean-mode@c1c68cc946 -> leanprover/lean-mode@362bc6fa3e ledger/ledger-mode@b55384d9cd -> ledger/ledger-mode@4b32f70173 midnightSuyama/shader-mode@d7dc8d0d6f -> midnightSuyama/shader-mode@fe5a1982ba necaris/conda.el@667968184e -> necaris/conda.el@28f51e49fd nlamirault/phpunit.el@fe6bc91c3b -> nlamirault/phpunit.el@4a36906344 ocaml-ppx/ocamlformat@9cbd8150c2 -> ocaml-ppx/ocamlformat@1ad4bdba9e ocaml/dune@3df932f7f9 -> ocaml/dune@f5a5a9c17b ocaml/merlin@be753d9412 -> ocaml/merlin@306af713e2 ocaml/tuareg@ad8a688b7e -> ocaml/tuareg@53ce2fdfdd pashky/restclient.el@9e2cfa8652 -> pashky/restclient.el@0ba72816f9 polymode/polymode@2094c92403 -> polymode/polymode@15b6c1e94a purcell/flycheck-package@615c1ed8c6 -> purcell/flycheck-package@3a6aaed29f purescript-emacs/purescript-mode@0acd1af446 -> purescript-emacs/purescript-mode@cf113871f9 s-kostyaev/go-gen-test@35df36dcd5 -> s-kostyaev/go-gen-test@f84f4177af seagle0128/grip-mode@6d6ddbe0af -> seagle0128/grip-mode@5809fb62f6 sebasmonia/sharper@96edd4a1db -> sebasmonia/sharper@496e90e337 smihica/emmet-mode@6b2e554f7f -> smihica/emmet-mode@63b6932603 swift-emacs/swift-mode@f4529efa45 -> swift-emacs/swift-mode@1244ee48de technomancy/fennel-mode@5664357349 -> technomancy/fennel-mode@52da9715b0 vspinu/company-math@45778f5731 -> vspinu/company-math@3eb006874e whirm/flycheck-kotlin@bf1b398bdd -> whirm/flycheck-kotlin@a2a6abb9a7 wwwjfy/emacs-fish@a7c953b149 -> wwwjfy/emacs-fish@d04478c0ab xuchunyang/elisp-demos@01c301b516 -> xuchunyang/elisp-demos@792be709c8 yoshiki/yaml-mode@535273d5a1 -> yoshiki/yaml-mode@3fcb36d603 ziglang/zig-mode@aa20d630b8 -> ziglang/zig-mode@9c5e41d6a0
:lang php
Description unfold
This module adds support for PHP 5.3+ (including PHP8) to Doom Emacs.
- ctags-based code completion (
company-php
andphpctags
) - eldoc support (
ac-php
andphp-extras
) - REPL (
psysh
) - Code refactoring commands (
php-refactor-mode
) - Unit-test commands (
phpunit
) - Support for
laravel
andcomposer
projects (with project-specific snippets) - File templates
- Snippets
💬 PHP was the first programming language I got paid to code in, back in the Cretaceous period (2003). My sincerest apologies go out to all the programmers who inherited my earliest PHP work. I know you're out there, writhing in your straitjackets.
Maintainers
Module flags
- +hack
- Add support for the Hack dialect of PHP by Facebook.
- +lsp
-
Enable LSP support for
php-mode
. Requires doom-module::tools lsp and a langserver (supports phpactor and intelephense). - +tree-sitter
- Leverages tree-sitter for better syntax highlighting and structural text editing. Requires doom-module::tools tree-sitter.
Packages
Hacks
No hacks documented for this module.
TODO Changelog
This module does not have a changelog yet.
Installation
Enable this module in your doom!
block.
This module requires php
(5.3+) and composer
.
If doom-module:+lsp is enabled, you'll also need one of these LSP servers:
- Phpactor requires
php
7.3+. - Intelephense requires
node
andnpm
.
PHP
MacOS
PHP 5.5 comes prepackaged with newer versions of MacOS. These instructions are provided for reference:
brew tap homebrew/homebrew-php
brew install php@8.0 # or php53, php54, php55
brew install composer
# If you use intelephense:
brew install node
brew install npm
Arch Linux
sudo pacman --needed --noconfirm -S php composer # or php53, php54, php55
# If you use intelephense:
sudo pacman -S nodejs npm
openSUSE
sudo zypper install php-composer
# If you use intelephense:
sudo zypper install nodejs npm
Debian
sudo apt-get install php php-common
# If you use intelephense:
sudo apt-get install nodejs npm
LSP Support
There are a number of currently supported LSP servers:
- Intelephense (Recommended)
- phpactor
- Serenata
- felixbecker (Considered unsupported)
Intelephense is currently the only server that supports automatic installation,
which will trigger either when you open a PHP project or manually invoke
lsp-install-server
through M-x.
The others have to be installed manually and added to your $PATH
.
Dependencies
pysh
(REPL)phpctags
(better code completion)phpunit
(unit test commands)php-cs-fixer
and@prettier/plugin-php
(for code formatting)phpactor
(for LSP if intelephense isn't desired)
composer global require \
psy/psysh \
phpunit/phpunit \
techlivezheng/phpctags \
friendsofphp/php-cs-fixer \
phpactor/phpactor
# Needed by php-cs-fixer, otherwise you'll get "Couldn't resolve parser
# 'php'" errors
npm install -g @prettier/plugin-php
You must ensure that $HOME/.composer/vendor/bin
is in $PATH
, so these
executables are visible to Emacs:
# place this in your profile file, like ~/.bash_profile or ~/.zshenv
export PATH="~/.composer/vendor/bin:$PATH"
You may also need to regenerate your envvar file by running $ doom env
on the
command line.
NOTE phpactor doesn't have to be installed via composer
, just has to exist in
your $PATH
.
NOTE Phpactor cannot be installed, globally at least, with PHP ^8.
TODO Usage
🔨 This module's usage documentation is incomplete. Complete it?
PHPUnit
This module provides an interface to PHPUnit through a number of commands as
detailed below. By default, it loads configuration from the root phpunit.xml
.
phpunit-current-project
Launch all tests for the projectphpunit-current-class
Launch all tests for the current class/fixturephpunit-current-test
Launch the current test at point
If for some reason, the default phpunit.xml
is in a different location (or you
use the phpunit.xml.dist
convention) , the path can be changed via
phpunit-configuration-file
(setq phpunit-configuration-file "phpunit.xml")
Composer
This module provides several convenience methods for triggering composer commands:
Binding | Function |
---|---|
<localleader> m c c | composer |
<localleader> m c i | composer-install |
<localleader> m c r | composer-require |
<localleader> m c u | composer-update |
<localleader> m c d | composer-dump-autoload |
<localleader> m c s | composer-run-scripts |
<localleader> m c v | composer-run-vendor-bin-command |
<localleader> m c o | composer-find-json-file |
<localleader> m c l | composer-view-lock-file |
These are all run via M-x too.
TODO Configuration
🔨 This module's configuration documentation is incomplete. Complete it?
Docker Compose
A lot of projects rely on running inside docker compose (ie Laravel), and as
such a minor mode has been configured to attempt to run tests inside the php-fpm
(by default) container.
This mode is disabled by default, to opt-in set +php-run-tests-in-docker
to t
in
your config. If this is done during Emacs running, you will also have to reload
php-mode
(i.e. through M-x php-mode
)
If you wish to specify a different container, modify the
+php-default-docker-container
variable (ideally inside a .dir-locals.el
file)
((php-mode . ((+php-default-docker-container . "php-octane"))))
Troubleshooting
"I'm missing functionality on lsp-mode"
Unfortunately, intelephense currently operates under a "freemium" model, and as such requires a license for extended features. Once purchased, this can be (insecurely) added directly to your config:
(setq lsp-intelephense-licence-key "<key>")
A more recommended approach would be to utilise Emacs' own auth-sources
for
storing authentication info, which can also be encrypted.
Create a file in your home directory (which can optionally be encrypted, verify
your auth-sources
has the correct values) called ~/.authinfo
:
machine * login intelephense password <key>
And add the following to your config:
(defun my-fetch-password (&rest params)
(require 'auth-source)
(let ((match (car (apply #'auth-source-search params))))
(if match
(let ((secret (plist-get match :secret)))
(if (functionp secret)
(funcall secret)
secret))
(error "Password not found for %S" params))))
(setq lsp-intelephense-licence-key (my-fetch-password :user intelephense))
Frequently asked questions
This module has no FAQs yet. Ask one?
TODO Appendix
🔨 This module has no appendix yet. Write one?