Docker image providing static analysis tools for PHP.
The list of available tools and the installer are actually managed in the jakzal/toolbox
repository.
Docker hub repository: https://hub.docker.com/r/jakzal/phpqa/
Nightly builds: https://hub.docker.com/r/jakzal/phpqa-nightly/
latest
,debian
(Dockerfile)1.98.6
,1.98
,1.98.6-debian
,1.98-debian
(Dockerfile)1.98.6-php8.1
,1.98-php8.1
,php8.1-debian
,php8.1
(Dockerfile)1.98.6-php8.2
,1.98-php8.2
,php8.2-debian
,php8.2
(Dockerfile)1.98.6-php8.3
,1.98-php8.3
,php8.3-debian
,php8.3
(Dockerfile)
alpine
(Dockerfile)1.98.6-alpine
,1.98-alpine
, (Dockerfile)1.98.6-php8.1-alpine
,1.98-php8.1-alpine
,php8.1-alpine
(Dockerfile)1.98.6-php8.2-alpine
,1.98-php8.2-alpine
,php8.2-alpine
(Dockerfile)1.98.6-php8.3-alpine
,1.98-php8.3-alpine
,php8.3-alpine
(Dockerfile)
Updated daily: latest
, debian
, alpine
, php8.4
, php8.4-alpine
, etc.
Updated on patch version change: 1.61
, 1.61-php8.4
, 1.61-php8.4-alpine
, etc.
Never updated: 1.61.0
, 1.61.0-php8.4
, 1.61.0-php8.4-alpine
, etc.
These are the latest tags for PHP versions that are no longer supported:
1.92.7-php8.0
,1.93-php8.0
,php8.0-debian
,php8.0
(Dockerfile)1.92.7-php8.0-alpine
,1.93-php8.0-alpine
,php8.0-alpine
(Dockerfile)1.80.0-php7.4
,1.80-php7.4
,php7.4-debian
,php7.4
(Dockerfile)1.80.0-php7.4-alpine
,1.80-php7.4-alpine
,php7.4-alpine
(Dockerfile)1.61.2-php7.3
,1.61-php7.3
,php7.3-debian
,php7.3
(debian/Dockerfile)1.61.2-php7.3-alpine
,1.61-php7.3-alpine
,php7.3-alpine
(alpine/Dockerfile)1.44.0-php7.2
,1.44-php7.2
,php7.2
(7.2/debian/Dockerfile)1.44.0-php7.2-alpine
,1.44-php7.2-alpine
,php7.2-alpine
(7.2/alpine/Dockerfile)1.26.0-php7.1
,1.26-php7.1
,php7.1
(7.1/debian/Dockerfile)1.26.0-php7.1-alpine
,1.26-php7.1-alpine
,php7.1-alpine
(7.1/alpine/Dockerfile)
Each tool is installed in the latest stable version if possible. Any Docker image has the latest available and installable version at the time of image creation.
Some tools are not included in the docker image, to use them refer to their documentation:
- exakat - a real time PHP static analyser
Name | Summary |
---|---|
analyze | Visualizes metrics and source code |
box-legacy | Legacy version of box |
composer-normalize | Composer plugin to normalize composer.json files |
design-pattern | Detects design patterns |
parallel-lint | Checks PHP file syntax |
php-formatter | Custom coding standards fixer |
phpcf | Finds usage of deprecated features |
phpda | Generates dependency graphs |
phpdoc-to-typehint | Automatically adds type hints and return types based on PHPDocs |
phpstan-localheinz-rules | Additional rules for PHPstan |
security-checker | Checks composer dependencies for known security vulnerabilities |
testability | Analyses and reports testability issues of a php codebase |
Pull the image:
docker pull jakzal/phpqa
The default command will list available tools:
docker run -it --rm jakzal/phpqa
To run the selected tool inside the container, you'll need to mount
the project directory on the container with -v "$(pwd):/project"
.
Some tools like to write to the /tmp
directory (like PHPStan, or Behat in some cases), therefore it's often useful
to share it between docker runs, i.e. with -v "$(pwd)/tmp-phpqa:/tmp"
.
If you want to be able to interrupt the selected tool if it takes too much time to complete, you can use the
--init
option. Please refer to the docker run documentation for more information.
docker run --init -it --rm -v "$(pwd):/project" -v "$(pwd)/tmp-phpqa:/tmp" -w /project jakzal/phpqa phpstan analyse src
You might want to tweak this command to your needs and create an alias for convenience:
alias phpqa='docker run --init -it --rm -v "$(pwd):/project" -v "$(pwd)/tmp-phpqa:/tmp" -w /project jakzal/phpqa:alpine'
Add it to your ~/.bashrc
so it's defined every time you start a new terminal session.
Now the command becomes a lot simpler:
phpqa phpstan analyse src
git clone https://github.com/jakzal/phpqa.git
cd phpqa
make build-debian
To build the alpine version:
make build-alpine
Please check out the cookbook for further tips & tricks.
Please read the Contributing guide to learn about contributing to this project. Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.