Skip to content
losnappas edited this page Jan 6, 2019 · 10 revisions

A pure PHP implementation of the open Language Server Protocol. Provides static code analysis for PHP for any IDE.

Uses the great Tolerant PHP Parser, phpDocumentor's DocBlock reflection and an event loop for concurrency.

Installing server with Plug in .vimrc

Plug 'felixfbecker/php-language-server', {'do': 'composer install && composer run-script parse-stubs'}

Registering in .vimrc

au User lsp_setup call lsp#register_server({                                    
     \ 'name': 'php-language-server',                                            
     \ 'cmd': {server_info->['php', expand('~/.vim/plugged/php-language-server/bin/php-language-server.php')]},
     \ 'whitelist': ['php'],                                                     
     \ })

A node implementation.

npm -g install intelephense-server

Registering in .vimrc

au User lsp_setup call lsp#register_server({
     \ 'name': 'intelephense',
     \ 'cmd': {server_info->['node', expand('~/.npm-global/lib/node_modules/intelephense-server/lib/server.js'), '--stdio']},
     \ 'whitelist': ['php'],
     \ })

If you don't have a ~/.npm-global folder, then probably /usr/lib/node_modules/.