๐ŸŒ AIๆœ็ดข & ไปฃ็† ไธป้กต
Skip to content

jakzal/phpqa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Static Analysis Tools for PHP

Docker image providing static analysis tools for PHP. The list of available tools and the installer are actually managed in the jakzal/toolbox repository.

Build Status Docker Pulls

Supported platforms and PHP versions

Docker hub repository: https://hub.docker.com/r/jakzal/phpqa/

Debian

  • latest, debian (Dockerfile)
  • 1.119.1, 1.119, 1.119.1-debian, 1.119-debian (Dockerfile)
  • 1.119.1-php8.2, 1.119-php8.2, php8.2-debian, php8.2 (Dockerfile)
  • 1.119.1-php8.3, 1.119-php8.3, php8.3-debian, php8.3 (Dockerfile)
  • 1.119.1-php8.4, 1.119-php8.4, php8.4-debian, php8.4 (Dockerfile)
  • 1.119.1-php8.5, 1.119-php8.5, php8.5-debian, php8.5 (Dockerfile)

Alpine

  • alpine (Dockerfile)
  • 1.119.1-alpine, 1.119-alpine, (Dockerfile)
  • 1.119.1-php8.2-alpine, 1.119-php8.2-alpine, php8.2-alpine (Dockerfile)
  • 1.119.1-php8.3-alpine, 1.119-php8.3-alpine, php8.3-alpine (Dockerfile)
  • 1.119.1-php8.4-alpine, 1.119-php8.4-alpine, php8.4-alpine (Dockerfile)
  • 1.119.1-php8.5-alpine, 1.119-php8.5-alpine, php8.5-alpine (Dockerfile)

Updated daily: latest, debian, alpine, php8.5, php8.5-alpine, etc. Updated on patch version change: 1.61, 1.61-php8.5, 1.61-php8.5-alpine, etc. Never updated: 1.61.0, 1.61.0-php8.5, 1.61.0-php8.5-alpine, etc.

Legacy

These are the latest tags for PHP versions that are no longer supported:

Available tools

Name Description PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
behat Helps to test business expectations โœ… โœ… โœ… โœ…
box Fast, zero config application bundler with PHARs โœ… โœ… โœ… โœ…
churn Discovers good candidates for refactoring โœ… โœ… โœ… โœ…
codeception Codeception is a BDD-styled PHP testing framework โœ… โœ… โœ… โŒ
composer Dependency Manager for PHP โœ… โœ… โœ… โœ…
composer-bin-plugin Composer plugin to install bin vendors in isolated locations โœ… โœ… โœ… โœ…
composer-lock-diff Composer plugin to check what has changed after a composer update โœ… โœ… โœ… โœ…
composer-normalize Composer plugin to normalize composer.json files โœ… โœ… โœ… โœ…
composer-require-checker Verify that no unknown symbols are used in the sources of a package. โŒ โœ… โœ… โœ…
composer-require-checker-3 Verify that no unknown symbols are used in the sources of a package. โœ… โœ… โœ… โœ…
composer-unused Show unused packages by scanning your code โœ… โœ… โœ… โœ…
cyclonedx-php-composer Composer plugin to create Software-Bill-of-Materials (SBOM) in CycloneDX format โœ… โœ… โœ… โœ…
dephpend Detect flaws in your architecture โœ… โœ… โœ… โœ…
deprecation-detector Finds usages of deprecated code โœ… โœ… โœ… โœ…
deptrac Enforces dependency rules between software layers โœ… โœ… โœ… โœ…
diffFilter Applies QA tools to run on a single pull request โœ… โœ… โœ… โœ…
ecs Sets up and runs coding standard checks โœ… โœ… โœ… โœ…
gherkin-lint-php Gherkin linter for PHP โœ… โœ… โœ… โœ…
infection AST based PHP Mutation Testing Framework โœ… โœ… โœ… โœ…
jack Helps to upgrade outdated Composer dependencies incrementally โœ… โœ… โœ… โœ…
kahlan Kahlan is a full-featured Unit & BDD test framework a la RSpec/JSpec โœ… โœ… โœ… โœ…
larastan PHPStan extension for Laravel โœ… โœ… โœ… โœ…
lines CLI tool for quick metrics of PHP projects โœ… โœ… โœ… โœ…
local-php-security-checker Checks composer dependencies for known security vulnerabilities โœ… โœ… โœ… โœ…
parallel-lint Checks PHP file syntax โœ… โœ… โœ… โœ…
paratest Parallel testing for PHPUnit โœ… โœ… โœ… โœ…
pdepend Static Analysis Tool โœ… โœ… โœ… โœ…
phan Static Analysis Tool โœ… โœ… โœ… โœ…
phive PHAR Installation and Verification Environment โœ… โœ… โœ… โœ…
php-cs-fixer PHP Coding Standards Fixer โœ… โœ… โœ… โœ…
php-fuzzer A fuzzer for PHP, which can be used to find bugs in libraries by feeding them 'random' inputs โœ… โœ… โœ… โœ…
php-semver-checker Suggests a next version according to semantic versioning โœ… โœ… โœ… โœ…
phpa Checks for weak assumptions โœ… โœ… โœ… โœ…
phparkitect Helps to put architectural constraints in a PHP code base โœ… โœ… โœ… โœ…
phpat Easy to use architecture testing tool โœ… โœ… โœ… โœ…
phpbench PHP Benchmarking framework โœ… โœ… โœ… โœ…
phpca Finds usage of non-built-in extensions โœ… โœ… โœ… โœ…
phpcb PHP Code Browser โœ… โœ… โœ… โœ…
phpcbf Automatically corrects coding standard violations โœ… โœ… โœ… โœ…
phpcodesniffer-composer-install Easy installation of PHP_CodeSniffer coding standards (rulesets). โœ… โœ… โœ… โœ…
phpcov a command-line frontend for the PHP_CodeCoverage library โŒ โœ… โœ… โœ…
phpcpd Copy/Paste Detector โœ… โœ… โœ… โœ…
phpcs Detects coding standard violations โœ… โœ… โœ… โœ…
phpcs-security-audit Finds vulnerabilities and weaknesses related to security in PHP code โœ… โœ… โœ… โœ…
phpdd Finds usage of deprecated features โœ… โœ… โœ… โœ…
phpDocumentor Documentation generator โœ… โœ… โœ… โœ…
phpinsights Analyses code quality, style, architecture and complexity โœ… โœ… โœ… โœ…
phplint Lints php files in parallel โœ… โœ… โœ… โœ…
phploc A tool for quickly measuring the size of a PHP project โœ… โœ… โœ… โœ…
phpmd A tool for finding problems in PHP code โœ… โœ… โœ… โœ…
phpmetrics Static Analysis Tool โœ… โœ… โœ… โœ…
phpmnd Helps to detect magic numbers โœ… โœ… โœ… โœ…
phpspec SpecBDD Framework โœ… โœ… โœ… โŒ
phpstan Static Analysis Tool โœ… โœ… โœ… โœ…
phpstan-banned-code PHPStan rules for detecting calls to specific functions you don't want in your project โœ… โœ… โœ… โœ…
phpstan-beberlei-assert PHPStan extension for beberlei/assert โœ… โœ… โœ… โœ…
phpstan-deprecation-rules PHPStan rules for detecting deprecated code โœ… โœ… โœ… โœ…
phpstan-doctrine Doctrine extensions for PHPStan โœ… โœ… โœ… โœ…
phpstan-ergebnis-rules Additional rules for PHPstan โœ… โœ… โœ… โœ…
phpstan-larastan Separate installation of phpstan for larastan โœ… โœ… โœ… โœ…
phpstan-phpunit PHPUnit extensions and rules for PHPStan โœ… โœ… โœ… โœ…
phpstan-strict-rules Extra strict and opinionated rules for PHPStan โœ… โœ… โœ… โœ…
phpstan-symfony Symfony extension for PHPStan โœ… โœ… โœ… โœ…
phpstan-webmozart-assert PHPStan extension for webmozart/assert โœ… โœ… โœ… โœ…
phpunit The PHP testing framework โŒ โœ… โœ… โœ…
phpunit-10 The PHP testing framework (10.x version) โœ… โœ… โœ… โœ…
phpunit-11 The PHP testing framework (11.x version) โœ… โœ… โœ… โœ…
phpunit-8 The PHP testing framework (8.x version) โœ… โœ… โœ… โœ…
phpunit-9 The PHP testing framework (9.x version) โœ… โœ… โœ… โœ…
pint Opinionated PHP code style fixer for Laravel โœ… โœ… โœ… โœ…
psalm Finds errors in PHP applications โœ… โœ… โœ… โœ…
psalm-plugin-doctrine Stubs to let Psalm understand Doctrine better โœ… โœ… โœ… โœ…
psalm-plugin-phpunit Psalm plugin for PHPUnit โœ… โœ… โœ… โœ…
psalm-plugin-symfony Psalm Plugin for Symfony โœ… โœ… โœ… โœ…
psecio-parse Scans code for potential security-related issues โœ… โœ… โœ… โœ…
rector Tool for instant code upgrades and refactoring โœ… โœ… โœ… โœ…
roave-backward-compatibility-check Tool to compare two revisions of a class API to check for BC breaks โœ… โœ… โœ… โœ…
simple-phpunit Provides utilities to report legacy tests and usage of deprecated code โœ… โœ… โœ… โœ…
twig-cs-fixer Automatically corrects twig files following the official coding standard rules โœ… โœ… โœ… โœ…
twig-lint Standalone cli twig 1.X linter โœ… โœ… โœ… โœ…
twig-linter Standalone cli twig 3.X linter โœ… โœ… โœ… โœ…
twigcs The missing checkstyle for twig! โœ… โœ… โœ… โŒ
yaml-lint Compact command line utility for checking YAML file syntax โœ… โœ… โœ… โœ…

More tools

Some tools are not included in the docker image, to use them refer to their documentation:

Removed tools

Name Summary
analyze Visualizes metrics and source code
box-legacy Legacy version of box
design-pattern Detects design patterns
parallel-lint Checks PHP file syntax
pest The elegant PHP Testing Framework
php-coupling-detector Detects code coupling issues
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-exception-rules PHPStan rules for checked and unchecked exceptions
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

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 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

Building the image

git clone https://github.com/jakzal/phpqa.git
cd phpqa
make build-debian

To build the alpine version:

make build-alpine

Cookbook

Please check out the cookbook for further tips & tricks.

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.