IlludiumPu36
IlludiumPu36

Reputation: 4304

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?

Upvotes: 1

Views: 647

Answers (2)

hakre
hakre

Reputation: 197658

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

https://hub.docker.com/_/composer

It will ship with PHP.

And in general you can't run Composer without PHP because it needs it to run.

It is just that within the Composer Docker container, there is PHP, too. So you install it by pulling the container.


Depending which operating system you're using and if you're concerned about the development environment(s), nix-shell(1) and nix-env(1) could be appropriate as well with more flexibility than Docker containers.

Upvotes: 1

fabpico
fabpico

Reputation: 2917

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.

Upvotes: 3

Related Questions