Phan

(( gitHubWatchers )) (( gitHubStars )) (( gitHubForks ))

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)

Make sure 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)

Make sure you have Composer and all dependencies pcntl, git, ext-ast installed.

Require it as a dev dependency:
composer require --dev phan/phan:0.8.x-dev (PHP 7.0)
composer require --dev phan/phan:1.x (PHP 7.1+)
Run it:
php vendor/bin/phan

Install from a Git repository (with Git)

Make sure you have git and Composer and all dependencies pcntl, git, ext-ast installed.

Git clone the repository:
git clone git://github.com/phan/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)

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

Make sure all dependencies are installed: pcntl, git, ext-ast.

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