https://github.com/tysonandre/flycheck-phanclient
Emacs flycheck php checker for quick static analysis. Also see https://github.com/TysonAndre/lsp-phan for Emacs 25.1+
https://github.com/tysonandre/flycheck-phanclient
emacs flycheck phan php php-static-analysis php7
Last synced: 3 months ago
JSON representation
Emacs flycheck php checker for quick static analysis. Also see https://github.com/TysonAndre/lsp-phan for Emacs 25.1+
- Host: GitHub
- URL: https://github.com/tysonandre/flycheck-phanclient
- Owner: TysonAndre
- License: mit
- Created: 2017-02-26T17:52:28.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-12T17:59:37.000Z (about 7 years ago)
- Last Synced: 2025-01-25T18:31:10.278Z (4 months ago)
- Topics: emacs, flycheck, phan, php, php-static-analysis, php7
- Language: Emacs Lisp
- Homepage:
- Size: 72.3 KB
- Stars: 4
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
- License: LICENSE
Awesome Lists containing this project
README
#+TITLE: Phan client for Emacs
* Description
This package adds support of [[https://github.com/phan/phan][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
#+ATTR_HTML: :style margin-left: auto; margin-right: auto;
[[./docs/flycheck_phan_example.png]]* Installation
Clone this repository to your computer. Then, load it in your Emacs configuration :
#+BEGIN_SRC emacs-lisp
(add-to-list 'load-path "/path/to/to/flycheck-phanclient")
(require 'flycheck-phanclient)
#+END_SRC* Usage
** Flycheck checker
First, load the flycheck checker:
#+BEGIN_SRC emacs-lisp
(require 'flycheck-phanclient)
#+END_SRCThen, 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
(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.
* Configuration
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.* Requirements
- PHP 7.x with the [[https://github.com/nikic/php-ast][php-ast extension]] installed (and in the PATH emacs searches for binaries).
- A PHP project with ~.phan/config.php~ set up. See [[https://github.com/phan/phan#getting-started][Phan - Getting Started]]
- A Phan daemon running in the project folder being opened by Emacs.
- A Phan 0.12.0+ installation.* Emacs dependencies
- 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-installation]][[Flycheck]]* Future Work
Create a plugin using the Language Server Protocol for the Emacs client (instead of the Phan-specific daemon mode).