Skip to content
Arnie97 edited this page Jul 2, 2020 · 10 revisions

A node implementation. Recommended (way faster than php-language-server)

npm -g install intelephense

Registering in .vimrc

  • Please set storagePath to any directory, e.g. 'storagePath': '/tmp/intelephense'
  • Refer to "Configuration Options" in intellephens-docs for configuration of workspace_config.
if executable('intelephense')
  augroup LspPHPIntelephense
    au!
    au User lsp_setup call lsp#register_server({
        \ 'name': 'intelephense',
        \ 'cmd': {server_info->[&shell, &shellcmdflag, 'intelephense --stdio']},
        \ 'whitelist': ['php'],
        \ 'initialization_options': {'storagePath': '/tmp/intelephense'},
        \ 'workspace_config': {
        \   'intelephense': {
        \     'files': {
        \       'maxSize': 1000000,
        \       'associations': ['*.php', '*.phtml'],
        \       'exclude': [],
        \     },
        \     'completion': {
        \       'insertUseDeclaration': v:true,
        \       'fullyQualifyGlobalConstantsAndFunctions': v:false,
        \       'triggerParameterHints': v:true,
        \       'maxItems': 100,
        \     },
        \     'format': {
        \       'enable': v:true
        \     },
        \   },
        \ }
        \})
  augroup END
endif

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', for: []}

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'],                                                     
     \ })