Docker
Docker, along with any common PHP extension, has built-in support in PHPStorm.
Many applications within the PHP container can be connected with PHPStorm for seamless development, debugging, and testing.
PHP Server
PHPStorm can connect to a remote PHP interpreter:
- Build and start the PHP Docker container.
- Add a new remote CLI interpreter.
- Point to the PHP container in Docker Compose or Docker.
- Set the
.../php.ini
configuration file if it is not detected.
Composer
Composer can be connected with PHPStorm:
- Select the pre-configured remote PHP interpreter.
- PHPStorm should auto-detect the default configuration.
PHPUnit
PHPUnit can be connected with PHPStorm:
- Add a new Test Framework (PHPUnit by Remote Interpreter).
- Select the preconfigured remote PHP interpreter.
- Set the autoload file
.../vendor/autoload.php
. - Set the configuration file
.../phpunit.xml
. - Set the bootstrap file
.../tests/bootstrap.php
. - Run some tests and check if the configuration works.
PHPStan
PHPStan can be connected with PHPStorm.
- Find PHPStan in Quality Tools.
- Select and enable the preconfigured PHP interpreter.
- Set the desired validation level.
- Set the configuration file
.../phpstan.neon
. - Set the autoload file
.../vendor/autoload.php
.
Tips
- Most configuration paths are meant to be used inside the container, not the host machine.