{"id":16915838,"url":"https://github.com/tysonandre/languageserver-phan-neovim","last_synced_at":"2026-05-04T16:33:36.983Z","repository":{"id":75022487,"uuid":"105421040","full_name":"TysonAndre/LanguageServer-phan-neovim","owner":"TysonAndre","description":"Phan language server support for neovim.","archived":false,"fork":false,"pushed_at":"2021-08-22T17:45:33.000Z","size":489,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-20T21:12:09.154Z","etag":null,"topics":["error-detection","neovim","neovim-plugin","phan","php","vim"],"latest_commit_sha":null,"homepage":"","language":"Vim script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TysonAndre.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-01T05:18:02.000Z","updated_at":"2022-11-27T02:37:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"aa940562-7930-424e-8dd4-d789cfbcad7e","html_url":"https://github.com/TysonAndre/LanguageServer-phan-neovim","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TysonAndre/LanguageServer-phan-neovim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TysonAndre%2FLanguageServer-phan-neovim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TysonAndre%2FLanguageServer-phan-neovim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TysonAndre%2FLanguageServer-phan-neovim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TysonAndre%2FLanguageServer-phan-neovim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TysonAndre","download_url":"https://codeload.github.com/TysonAndre/LanguageServer-phan-neovim/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TysonAndre%2FLanguageServer-phan-neovim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32615563,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"ssl_error","status_checked_at":"2026-05-04T10:08:02.005Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["error-detection","neovim","neovim-plugin","phan","php","vim"],"created_at":"2024-10-13T19:23:01.425Z","updated_at":"2026-05-04T16:33:36.968Z","avatar_url":"https://github.com/TysonAndre.png","language":"Vim script","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LanguageServer-phan-neovim\n\n[![Minimum PHP Version](https://img.shields.io/badge/php-%3E=7.0-8892BF.svg)](https://php.net/) [![Gitter](https://badges.gitter.im/phan/phan.svg)](https://gitter.im/phan/phan?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)\n\nA PHP language server plugin for [LanguageClient-neovim](https://github.com/autozimu/LanguageClient-neovim).\nThis uses Phan's static analysis capabilities to quickly emit diagnostic issue messages.\n\nThis uses [Phan](https://github.com/phan/phan).\n\nAlso see [LanguageServer-php-neovim](https://github.com/roxma/LanguageServer-php-neovim), a plugin for a different language server (with different features) that this is based on.\n\n## Features\n\n+ Adds improved [error detection from Phan](https://github.com/phan/phan#features) to neovim.\n+ Analyzes code while you're typing.\n+ Analyzes remaining statements of code with syntax errors.\n+ Supports \"Go To Definition\" (`:call LanguageClient#textDocument_definition()`)\n+ Supports \"Hover\" (`:call LanguageClient#textDocument_hover()`)\n+ Supports \"Completion\" (e.g. with C-x o) (requires `let g:phan_enable_completion = 1` to be added to your vim/neovim config)\n\nSee [LanguageClient-neovim](https://github.com/autozimu/LanguageClient-neovim/) and [Example Configuration for LanguageServer-phan-neovim](#configuration) for more documentation on how to use these features.\n\n## Issue Tracker\n\n**Note: This is just the [neovim plugin that spawns Phan](https://github.com/TysonAndre/LanguageServer-phan-neovim). Phan is implemented purely in PHP [in its own repository](https://github.com/phan/phan),\nbugs in Phan analysis need to be fixed there and all issues should be reported [there](https://github.com/phan/phan/issues).**\n\nHowever, bugs in this neovim plugin (crashes, etc) or related to the language server protocol should be reported [in this plugin's issue tracker](https://github.com/TysonAndre/LanguageServer-phan-neovim/issues)\n\n## Examples\n\n### Error Detection\n\n![Phan error detection demo](https://raw.githubusercontent.com/TysonAndre/LanguageServer-phan-neovim/master/images/error_detection.png)\n\n### Error Detection (Tolerating Syntax Errors)\n\n![Phan error tolerant parsing demo](https://raw.githubusercontent.com/TysonAndre/LanguageServer-phan-neovim/master/images/tolerant_parsing.png)\n\n### Hover\n\n![Phan hover demo](https://raw.githubusercontent.com/TysonAndre/LanguageServer-phan-neovim/master/images/hover.png)\n\n### Completion\n\n![Phan completion demo](https://raw.githubusercontent.com/TysonAndre/LanguageServer-phan-neovim/master/images/completion.png)\n\n## Installation\n\n### Dependencies:\n\n1. PHP 7.2+ must be installed.\n   You can either add it to your PATH or set the `g:phan_php_binary` setting in `~/.config/nvim/init.vim`. (e.g. `let g:phan_php_binary = '/usr/local/php7.1/bin/php'`)\n2. (Optional) For optimal performance and accuracy of analysis,\n   [the `php-ast` PECL extension](https://pecl.php.net/package/ast) should be installed and enabled.\n\nUsing [vim-plug](https://github.com/junegunn/vim-plug).\n\nSee https://github.com/junegunn/vim-plug#usage if you are unfamiliar with vim-plug. After adding the plugins to your neovim config, `:PlugInstall` must be called to install the plugins.\n\n```vim\n\" Oddly, LanguageClient seems to need a key in LanguageClient_serverCommands when starting up in order for this plugin to work.\n\" Use literally anything as a placeholder. even 'php': ['/bin/false'],\nlet g:LanguageClient_serverCommands = {\n    \\ 'php': [$HOME . '/.vim/plugged/LanguageServer-phan-neovim/vendor/phan/phan/phan', '--require-config-exists', '--language-server-on-stdin', '--quick', '--language-server-allow-missing-pcntl', '--use-fallback-parser', '--allow-polyfill-parser', '--memory-limit', '2G', '--language-server-enable-go-to-definition', '--language-server-enable-hover', '--language-server-enable-completion', '--language-server-hide-category', '--analyze-all-files', '--plugin', 'InvokePHPNativeSyntaxCheckPlugin'],\n    \\ }\n\n\"\" The below would be ~/.vim/plugged in vim\n\"\" uncomment it if a section with plug#begin does not exist already\n\" call plug#begin('~/.local/share/nvim/plugged')\n\n\" Note: this may need to be 'composer.phar update', or contain the full path to composer.phar.\n\" To update the language server this vim plugin installs, run `:PlugUpdate! LanguageServer-phan-neovim`\nPlug 'TysonAndre/LanguageServer-phan-neovim',  {'do': 'composer update'}\n\" Currently, the Phan Language Server only works with a single directory,\n\" and that directory must be manually configured.\nlet g:phan_analyzed_directory = '/home/username/path/to/project-with-phan-config/'\n\n\"\" As a workaround, you can try to guess other projects on startup based on the current working directory\n\" if getcwd() =~ 'my-other-project\"\n\"  let g:phan_analyzed_directory = '/home/username/path/to/my-other-project/'\n\" endif\n\n\" You can optionally use a different Phan version from the one that gets bundled with this\n\" (Or phan.phar)\n\" let g:phan_executable_path = '~/path/to/phan-installation/phan'\n\n\" Completion is enabled by default if you're running the latest version of this vim plugin.\n\" let g:phan_enable_completion = 1\n\n\" Enable this to run Phan analysis only on file save\n\" (Not while editing the file)\n\" This will reduce CPU used and make crashes less likely.\n\" (LanguageClient-neovim won't automatically restart the server)\n\" let g:phan_analyze_only_on_save = 1\n\n\" You can also add custom CLI flags manually\nlet g:phan_additional_cli_flags = [\n  \\'--strict-type-checking',\n  \\'--plugin', 'InvokePHPNativeSyntaxCheckPlugin'\n  \\]\n\n\" Dependency:\nPlug 'autozimu/LanguageClient-neovim', { 'branch': 'next', 'do': 'bash install.sh' }\n\n\" call plug#end() \"  uncomment if a section with plug#begin and plug#end does not exist already\n```\n\nMany more settings for the Phan Language Server exist. [`:help LanguageServer-phan-neovim` will bring up documentation for these settings](doc/LanguageServer-phan-neovim.txt)\n\n\nI recommend adding some of the following settings to your Vim 8/Neovim settings as well (this is optional):\n\n```vim\nfunction! CopenInBackground()\n    \" get current window number\n    let winnum = winnr()\n    \" Open the QuickFix window with a height of 5 rows\n    copen 5\n    \" Switch back from the QuickFix window to the original window and redraw\n    execute winnum . \"wincmd w\"\n    :redraw!\nendfunction!\n\n\" From :help LanguageClient\naugroup LanguageClient_config\n    autocmd!\n    \" The below setting is recommended for LanguageClient-neovim\n    \" to stop the left column from flickering on and off\n    \" Note: This affects all open panes of vim.\n    \" Use setlocal instead of set if you want to only affect the active pane.\n    autocmd User LanguageClientStarted set signcolumn=yes\n    autocmd User LanguageClientStopped set signcolumn=auto\n\n    \" Discard *all* errors in the QuickFix window if the language server\n    \" stops or crashes\n    autocmd User LanguageClientStopped call setqflist([])\n\n    \" This will automatically open the QuickFix window with 5 lines of space\n    \" when the language server starts\n    \" (and close it when it's stopped or crashes)\n    autocmd User LanguageClientStarted call CopenInBackground()\n    autocmd User LanguageClientStopped cclose\naugroup end\n```\n\nIf you install this plugin manually, then execute the following commands in this directory:\n\n```sh\n# Or possibly composer.phar install\ncomposer install\n```\n\n## Updating\n\nThis repo is updated much less frequently than the Phan repo itself.\n\nTo update the version of Phan that is bundled with this client, run `:PlugUpdate! LanguageServer-phan-neovim`\n\n## Configuration\n\nYou must add this to your vimrc or neovim config:\n\n```vim\nautocmd FileType php LanguageClientStart\n```\n\n[LanguageClient - Quick Start](https://github.com/autozimu/LanguageClient-neovim#quick-start) has example configuration.\n\nExample aliases\n\n```vim\n\" Keyboard shortcuts to go to the definition or type definition.\nnnoremap \u003csilent\u003e g1 :call LanguageClient#textDocument_definition()\u003cCR\u003e\nnnoremap \u003csilent\u003e g2 :call LanguageClient#textDocument_typeDefinition()\u003cCR\u003e\n\" By default, this hover command opens the hover description in a preview pane,\n\" which can be closed with C-w z or C-w C-z\nnnoremap \u003csilent\u003e g3 :call LanguageClient#textDocument_hover()\u003cCR\u003e\n\" These shortcuts (Ctrl-W followed by the string 'g1', etc.)\n\" can be used to open the definition in a new pane.\nnnoremap \u003csilent\u003e \u003cC-W\u003eg1 :call LanguageClient#textDocument_definition({'gotoCmd': 'split'})\u003cCR\u003e\nnnoremap \u003csilent\u003e \u003cC-W\u003eg2 :call LanguageClient#textDocument_typeDefinition({'gotoCmd': 'split'})\u003cCR\u003e\nnnoremap \u003csilent\u003e \u003cC-W\u003eg3 :call LanguageClient#textDocument_hover()\u003cCR\u003e\n```\n\nNote: By default, LanguageClient-neovim supports code completion requests with `C-x o`\n\n## Documentation\n\n`:help LanguageServer-phan-neovim` can be used to see [the documentation for this PHP language server](doc/LanguageServer-phan-neovim.txt).\n`:help LanguageClient` can be used to get documentation for the Vim/Neovim language client settings.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftysonandre%2Flanguageserver-phan-neovim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftysonandre%2Flanguageserver-phan-neovim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftysonandre%2Flanguageserver-phan-neovim/lists"}