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:
(require 'flycheck-phanclient)
Then, start the daemon in the folder to analyze, with the default port of 8486 (see phan/phan#563)
TODO: add a way to configure individual project settings
(e.g. .dir-locals.el
)
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 $PATH
.
Currently, the phan daemon must be started manually on the directory
(must have .phan/config.php
somewhere in the folder or parent folders).
No warning/notice is currently emitted if the daemon is not running.
Type 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.php
set 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.
E.g. by using https://github.com/ejmr/php-mode#installation~php-mode~ from MELPA
- http://www.flycheck.org/en/latest/user/installation.html#package-installationFlycheck
Create a plugin using the Language Server Protocol for the Emacs client (instead of the Phan-specific daemon mode).