how to use composer?

I create a PHP execution environment (for testing) with Docker on windows10 and deploy the files created with PhpStorm2020.2 to the folder shared by Docker and execute it.
(Debugging is working without problems, and the execution environment is functioning)

I made composer.json in the project to use Composer.
For Composer settings, composer.phar is selected and downloaded from getcomposer.org, and the interpreter is the "default project interpreter".

And when I open composer.json in PhpStorm and try to install it, the log "Composer could not find a composer.json file in /home/foo/composer" is displayed.

I want to use Composer in my current project, not in the deploy location.
Also, if it is not installed in the project, I may not be able to upload tested packages etc. when deploying to the production environment.

What kind of settings should I make?

6 comments
Comment actions Permalink

As a matter of course, if you copy composer.json to the shared folder and execute the installation, it will be installed in the shared folder.
And the composer.json in the project keeps showing "Package not installed" alert.

0
Comment actions Permalink

and the interpreter is the "default project interpreter".

Is it a Docker / Docker Compose interpreter?

And when I open composer.json in PhpStorm and try to install it, the log "Composer could not find a composer.json file in /home/foo/composer" is displayed.

If it is a Docker / Docker Compose interpreter, this message is expected - PhpStorm is trying to run Composer inside the container, you need to switch Composer to use a local PHP interpreter instead.

0
Comment actions Permalink
Yes, I specify PHP as a virtual environment built with Docker.
I had to specify a local PHP interpreter.
Download XAMPP or the binary for Windows and try it.
 
0
Comment actions Permalink

I tried.
Using XAMPP didn't work, but downloading the Windows binaries from php.net worked.
Since I am using mailparse, I also downloaded the windows binary, but XAMPP did not recognize it even if I wrote it in pnp.ini, and I could not install it with pecl.

0
Comment actions Permalink

Since I am using mailparse, I also downloaded the windows binary, but XAMPP did not recognize it even if I wrote it in pnp.ini, and I could not install it with pecl.

I just downloaded Windows binaries for mailparse v3.1.0 and installed them without any issues. Make sure that the bitness and the thread safety match your interpreter.

0
Comment actions Permalink

Thank you for your comment.

I didn't work with XAMPP, but php and mailparse downloaded from php.net worked fine.

I don't need XAMPP, I just need composer to work, so I'm happy with this.

If there is a reason to use XAMPP in my local environment, I will consider it additionally.

0

Please sign in to leave a comment.