Skip to content

michaeljoelphillips/phpls

Repository files navigation

PHPLS

Build Status 70% PHPStan Enabled

A lightweight language server for PHP.

  • Completion
  • Diagnostics
  • Signature Help

asciicast

Getting Started

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

Neovim 0.5.0

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

Vim/Neovim 0.4.0

Configuration

PHPLS can be configured via $XDG_CONFIG_HOME/phpls/config.php. See config.php.dist.