GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - phan/docker: Dockerization of the Phan PHP static analysis tool

BranchesTags
Open more actions menu

Latest commit

 

History

41 Commits
41 Commits

Folders and files

NameName
Last commit message
Last commit date
builder
builder
 
 
examples/installing_extensions
examples/installing_extensions
 
 
templates
templates
 
 
test
test
 
 
versions/5
versions/5
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
BUILD.md
BUILD.md
 
 
Dockerfile
Dockerfile
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build
build
 
 

Repository files navigation

phan/docker

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

phan/docker is a fork of cloudflare/docker-phan

Motivations

Phan requires PHP7.2+ and specific PHP extensions to be installed. These docker images use either php 8 or php 7.

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 phan/docker

The easiest way to use phan/docker 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)" phanphp/phan:latest $@; return $?; }

(You may replace “latest” with a tagged Phan release such as 5 or 5.2 or 5.2.1 to use a specific version of Phan.)

Running phan/docker

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

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

Example

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

phan -po analysis.txt

To run phan on a project that already has a .phan/config.php set up (assuming no symlinks)

cd /path/to/project
# short for: docker run -v $PWD:/mnt/src --rm -u "$(id -u):$(id -g)" phanphp/phan:latest
phan

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.

Phan reports that classes from a PHP module are missing

Configuring Stubs

This aims to be a minimal docker image, and does not include many common PHP modules(extensions).

See https://github.com/phan/phan/wiki/How-To-Use-Stubs#internal-stubs for how to generate stubs from installed extensions and configure phan to use those stubs if the extension is not installed.

Extending phan/docker with extra PHP modules

Installing the PHP modules may give phan better type information than stubs in some cases.

See examples/installing_extensions for how to do that.

License

BSD 2-Clause License

About

Dockerization of the Phan PHP static analysis tool

Topics

dockerphanphpstatic-analysis

Resources

Readme
License
Activity
Custom properties

Stars

2 stars

Watchers

3 watching

Forks

3 forks
Report repository

Releases

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.