Public Repository

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

docker-phan

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.

Motivations

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.

Example

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

phan -po analysis.txt

Building

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 BUILD.md for more information.

License

BSD 2-Clause License

Docker Pull Command
Owner
cloudflare

Comments (1)
cerebralfart
a month ago

What version of phan is this (currently) running?