A lightweight language server for PHP.
- Completion
- Diagnostics
- Signature Help
Download the phar from the releases page.
# Over stdio
phpls
# As a TCP client
phpls --mode=client --port=9900
# As a TCP server
phpls --mode=server --port=9900
Note: STDIO
mode is not supported for users on Windows
Install the neovim/nvim-lspconfig plugin and add the following to your vimrc:
lua << EOF
local nvim_lsp = require 'nvim_lsp'
local configs = require 'nvim_lsp/configs'
local util = require 'nvim_lsp/util'
local lsp = vim.lsp
configs.phpls = {
default_config = {
cmd = {"php", "-d", "memory_limit=512M", "/usr/local/bin/phpls"};
filetypes = {"php"};
root_dir = util.root_pattern("composer.lock", ".git");
log_level = lsp.protocol.MessageType.Warning;
settings = {};
};
}
EOF
PHPLS can be configured via $XDG_CONFIG_HOME/phpls/config.php
. See
config.php.dist
.