Phan

Author(s)
Rasmus Lerdorf, Andrew Morrison
Website
https://github.com/etsy/phan
License
MIT License
GitHub
etsy/phan
Packagist
etsy/phan
DockerHub
phpqa/phan
Dependencies
pcntl, git, ext-ast

0 0 0

Phan is a static analyzer for PHP.

Phan prefers to avoid false-positives and attempts to prove incorrectness rather than correctness.

Installation

Install from a Brew package (with Brew)

Check if all dependencies are installed: pcntl, git, ext-ast.

Commandline
Install it:
brew install php71 php71-ast phan

Install from a Composer package as a dev dependency (with Composer)

Check if all dependencies are installed: pcntl, git, ext-ast.

Make sure you have Composer installed.

Require it as a dev dependency:
composer require --dev etsy/phan:0.8.x-dev (PHP 7.0)
composer require --dev etsy/phan:dev-master (PHP 7.1)
Run it:
php phan

Install from a Git repository (with Git)

Check if all dependencies are installed: pcntl, git, ext-ast.

Make sure you have git and Composer installed.

Git clone the repository:
git clone git://github.com/etsy/phan.git
Change into the new directory:
cd phan
Install the project dependencies:
composer install
Run it:
php phan

Install from a PHP Archive (with curl or wget)

Check if all dependencies are installed: pcntl, git, ext-ast.

The PHPUnit documentation has a clear manual on how to install PHARs on Windows.

If you have the Suhosin extension enabled, make sure to allow the execution of PHARs in your php.ini:
suhosin.executor.include.whitelist = phar

Locally (X.X.X)
Download it:
wget -O phan.phar https://github.com/etsy/phan/releases/download/X.X.X/phan.phar
or
curl -sSL https://github.com/etsy/phan/releases/download/X.X.X/phan.phar -o phan.phar
Use it:
php phan.phar
Globally (X.X.X)
Download it:
wget -O phan.phar https://github.com/etsy/phan/releases/download/X.X.X/phan.phar
or
curl -sSL https://github.com/etsy/phan/releases/download/X.X.X/phan.phar -o phan.phar
Install it as an executable:
chmod a+x phan.phar
sudo mv phan.phar /usr/local/bin/phan
Use it:
phan