Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

cloudflare/docker-phan

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

About

Dockerization of the Phan PHP static analysis tool

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published