phpcomposer-phpphpstormphpcodesniffer

PHP Composer and PhpStorm - PHP 5.3.3 to 7.4


I am wanting to check PHP 5.3.3 scripts for compatibility to upgrade to PHP 7.4. I have PhpStorm 2022.1.2.

I gather I need to install PHP_CodeSniffer, probably in PhpStorm for convenience.

Composer seems to want PHP installed on my development computer (which is separate from my server...). Is there an alternative to this? Or how should Composer be installed without PHP on my local machine?


Solution

  • Composer seems to want PHP installed on my development computer (which is separate from my server...). Is there an alternative to this?

    An alternative of having PHP installed on your local machine, is to install PHP in a virtual environment of your local machine.

    You can do this with Docker. PHP Docker image: https://hub.docker.com/_/php

    Additionally install Composer in your Docker image: https://getcomposer.org/download/

    Then you can bash into the Docker container. In that container you can install all packages you want and run Composer.

    At the end, PHP and Composer are not installad on your local machine directly, they are installed in the virtual environment of Docker (in a container) on your local machine.