Phan client for Emacs
This package adds support of phan (0.12.0+), the PHP static analyzer, to Emacs (as a flycheck plugin). The main feature is quick analysis of individual php files in a project, with the assistance of a background phan daemon.
This is an early version with very few features.
This is based on https://github.com/stevenremot/emacs-phan
Clone this repository to your computer. Then, load it in your Emacs configuration :
(add-to-list 'load-path "/path/to/to/flycheck-phanclient") (require 'flycheck-phanclient)
First, load the flycheck checker:
Then, start the daemon in the folder to analyze, with the default port of 8486 (see https://github.com/phan/phan/pull/563)
TODO: add a way to configure individual project settings
This should be enough to have the flycheck checker run on your project. This will run while the project is being edited, even without saving the file.
Note: The request frequency may still need to be tuned for larger projects.
You need to install phan manually, and use a git branch with the phan daemon installed.
Ensure that the PHP program
phan_client is in your path, or copied to a folder in your
Currently, the phan daemon must be started manually on the directory
.phan/config.php somewhere in the folder or parent folders).
No warning/notice is currently emitted if the daemon is not running.
M-x customize-group RET phanclient RET to see the other customization options.
More customization options will be added in the future.
- PHP 7.x with the php-ast extension installed (and in the PATH emacs searches for binaries).
- A PHP project with
.phan/config.phpset up. See Phan - Getting Started
- A Phan daemon running in the project folder being opened by Emacs.
- A Phan 0.12.0+ installation.
- Flycheck must know that the current file’s file type is PHP.
Create a plugin using the Language Server Protocol for the Emacs client (instead of the Phan-specific daemon mode).