

You can update the phpstan.neon file in order to use the extension: includes : - /composer/vendor/phpstan/phpstan -phpunit/extension.neon Install PHP extensions #

Here is an example Dockerfile for phpstan/phpstan-phpunit: FROM ghcr.io/phpstan/phpstan:latest RUN composer global require phpstan/phpstan-phpunit In some cases you also need some additional PHP extensions like DOM. If you need a PHPStan extension, for example phpstan/phpstan-phpunit, you can simply extend an existing image and add the relevant extension via Composer. If you don’t have set the alias, use this command to run the container: docker run -rm -v /path/to/app:/app ghcr.io/phpstan/phpstan įor example: docker run -rm -v /path/to/app:/app ghcr.io/phpstan/phpstan analyse /app/src Install PHPStan extensions # alias phpstan = 'docker run -v $PWD:/app -rm ghcr.io/phpstan/phpstan' To use phpstan everywhere in the CLI add this line to your ~/.zshrc, ~/.bashrc, or ~/.profile. We recommend to use the images as a shell alias shortcut. To force PHPStan consider the analysed source code to be for a different PHP version, set phpVersion in your phpstan.neon: parameters : phpVersion : 70400 # PHP 7.4 Usage # The images are based on PHP 8.0 and PHP 8.1. Installation # docker pull ghcr.io/phpstan/phpstanĪlternatively, pull a specific version: docker pull ghcr.io/phpstan/phpstan:1 Different PHP version? # nightly-php8.2 - latest dev version (PHP 8.2).nightly-php8.1 - latest dev version (PHP 8.1).nightly, nightly-php8.0 - latest dev version (PHP 8.0).It’s hosted on GitHub Container Registry. The image is based on Alpine Linux and updated automatically.
