Editor Setup¶
PHPantom communicates over stdin/stdout using the standard Language Server Protocol. Any editor with LSP support can use it. No special initialization options are required.
Automatic Installation¶
These editors download and manage the PHPantom binary for you. To use a newer version than what your editor provides, install it manually and put phpantom_lsp on your PATH.
Zed¶
PHPantom is supported directly by Zed's official PHP extension, no separate PHPantom extension needed. Install (or update) the PHP extension from Zed's Extensions panel, then add PHPantom to your Zed settings.json:
{
"languages": {
"PHP": {
"language_servers": ["phpantom", "!intelephense", "!phpactor", "!phptools", "..."]
}
}
}
VS Code / Cursor¶
Install the PHPantom extension from the VS Code Marketplace. It automatically downloads the language server binary and starts it when you open a PHP file.
Manual Installation¶
These editors require you to install PHPantom first.
Neovim¶
PHPantom is included in nvim-lspconfig (just needs to be enabled). If you do not use nvim-lspconfig, then you will need to manually configure it:
vim.lsp.config('phpantom_lsp', {
cmd = { 'phpantom_lsp' },
filetypes = { 'php' },
root_markers = { '.phpantom.toml', '.git', 'composer.json' },
})
Finally, enable it with:
PHPStorm¶
-
Install LSP4IJ from Editor > Plugins, then restart PHPStorm.
-
Navigate to Languages & Frameworks > Language Servers and click + to add a new server:
- Name:
PHPantom - Command: path to your
phpantom_lspbinary - Mapping: set
PHPon both the Language tab and the File Type tab. Setting both ensures PHPStorm activates the server reliably.
- Name:
Sublime Text¶
-
Open the Command Palette (
Ctrl+Shift+P/Cmd+Shift+P), typePackage Control: Install Package, and install LSP. -
Open the Command Palette again, type
Preferences: LSP Server Configurations, and add:
{
"phpantom": {
"enabled": true,
"command": ["phpantom_lsp"],
"selector": "embedding.php",
"priority_selector": "source.php"
}
}
Make sure phpantom_lsp is on your PATH, or replace it with the full path to the binary.
Helix¶
Add PHPantom to your languages.toml (typically ~/.config/helix/languages.toml):
[language-server.phpantom]
command = "phpantom_lsp"
[[language]]
name = "php"
language-servers = ["phpantom"]
Emacs (eglot)¶
Note
This configuration is untested. If you get it working (or run into issues), please open an issue.
Eglot is built into Emacs 29+. Add to your init.el:
Then open a PHP file and run M-x eglot.
Emacs (lsp-mode)¶
Note
This configuration is untested. If you get it working (or run into issues), please open an issue.
Add to your init.el:
(with-eval-after-load 'lsp-mode
(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection '("phpantom_lsp"))
:activation-fn (lsp-activate-on "php")
:server-id 'phpantom)))
Then open a PHP file and run M-x lsp.
Kate¶
Note
This configuration is untested. If you get it working (or run into issues), please open an issue.
Open Settings > Configure Kate > LSP Client > User Server Settings and add:
{
"servers": {
"php": {
"command": ["/path/to/phpantom_lsp"],
"url": "https://github.com/PHPantom-dev/phpantom_lsp"
}
}
}
For AI coding agent setup, see Agent Setup.