Static Analysis Tools for PHP
Docker image providing static analysis tools for PHP.
Available tools
- composer - Dependency Manager for PHP
- box - An application for building and managing Phars
- php-cs-fixer - PHP Coding Standards Fixer
- phpcf - Finds usage of deprecated features
- phpca - Finds usage of non-built-in extensions
- phpdoc-to-typehint - Automatically adds type hints and return types based on PHPDocs
- php-formatter - Custom coding standards fixer
- phpmetrics - Static Analysis Tool
- phpstan - Static Analysis Tool
- phan - Static Analysis Tool
- dephpend - Detect flaws in your architecture
- psalm - Finds errors in PHP applications
- phpDocumentor - Documentation generator
- phpcpd - Copy/Paste Detector
- phploc - A tool for quickly measuring the size of a PHP project
- phpmd - A tool for finding problems in PHP code
- phpmnd - Helps to detect magic numbers
- pdepend - Static Analysis Tool
- phpcs - Detects coding standard violations
- phpcbf - Automatically corrects coding standard violations
- phpcb - PHP Code Browser
- phpa - Checks for weak assumptions
- deprecation-detector - Finds usages of deprecated code
- deptrac - Enforces dependency rules
- phpda - Generates dependency graphs
- php-coupling-detector - Detects code coupling issues
- analyze - Visualizes metrics and source code
- design-pattern - Dettects design patterns
- parallel-lint - Checks PHP file syntax
- php-semver-checker - Suggests a next version according to semantic versioning
Running tools
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:
docker run -it --rm -v $(pwd):/project -w /project jakzal/phpqa phpstan analyse src
Building the image
git clone https://github.com/jakzal/phpqa.git
cd phpqa
make build
To build the alpine version:
make build-alpine
Customising the image
It's often needed to customise the image with project specific extensions.
To achieve that simply create a new image based on jakzal/phpqa
:
FROM jakzal/phpqa:alpine
RUN apk add --no-cache libxml2-dev \
&& docker-php-ext-install soap
Next, build it:
docker build -t foo/phpqa .
Finally, use your customised image instead of the default one:
docker run -it --rm -v $(pwd):/project -w /project foo/phpqa phpmetrics .
Contributing
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.