Public Repository

Last pushed: 6 days ago
Short Description
Dockerization of the Phan PHP static analysis tool
Full Description


An installation of PHP7 and Phan in a super tiny Alpine Linux
Docker image. The image is just 17 MB and runs interactively on the files
outside your container, making it easy to statically analyze PHP code.


Phan requires PHP7 and specific PHP extensions to be installed. PHP7 isn’t
packaged yet for many Linux distributions and users would still need to compile
and enable the extra PHP extensions.

By packaging Phan inside a Docker image, we can separate the runtime and
configuration of the tool from your application’s environment and requirements.

Getting docker-phan

The easiest way to use docker-phan is to create a shell function for “phan”
that makes makes it nearly transparent that phan is running inside Docker.

phan() { docker run -v $PWD:/mnt/src --rm -u "$(id -u):$(id -g)" cloudflare/phan:latest $@; return $? }

(You may replace “latest” with a tagged Phan release to use a specific version
of Phan.)

Running docker-phan

If you’re just getting started with Phan, you should follow Phan’s excellent
Tutorial for Analyzing A Large Sloopy Code Base to setup the
initial configuration for your project.

All of Phan’s command line flags can be passed to docker-phan.


To create an “analysis.txt” in the current directory for farther processing

phan -po analysis.txt


Docker images are built with the build script based on the awesome building
and testing framework put into place by the docker-alpine
contributors. See for more information.


BSD 2-Clause License

Docker Pull Command