How to develop with git+PHPStorm


How do you use devilbox to develop with git + phpstorm on windows? I can run the containers, I see them from in there… How do I access the files and test the code? I see info about xdebug but I think I’m missing a step as I can debug fine in local projects, just not through docker/devilbox. Can the code be put in a git repo? I would like to just have a phpinfo file show me it’s running the right version of php to begin with…



Im using phpstorm + devilbox + git + nodejs + another cool things without problem…

Which files you need to access ? Your project files ?

Your project files are stored on windows host machine… and mapped to php container…
You can run git on local machine or you can access php container shell and work with git there … it is on your decision…

Debuging with xdebug works fine too…

I am working on Linux. I managed to connect to the docker with PHPStorm and use remote interpreter and also to connect with PHPUnit which is installed with composer inside the project.

Everything is working fine until you need to test the database. Because PHPStorm is connecting through docker the internal network isn’t available. So connecting to the database fails. I couldn’t connect through docker-compose so I can’t test this alternative but I am assuming that connecting through docker-compose it would work.

I advise you to use Git in your host and not inside docker container because with every docker container purge you would need to set up Git again.

I’ll add to this - I use phpstorm and devilbox for a big app I’m working on.

  • I can connect to the devilbox database by just sharing port 3306 from the box to my host, then connecting like it’s a local mysql at :3306.
  • I can get the debugging working (more or less)
  • I have no clue how to make phpstorm work properly with PHPUnit testing inside a docker container-- it’s a nightmare to configure and throws weird error messages. I’ve tried everything, no luck. Maybe you’ll have better luck.

And of course all my code is handled with git, which I do on the host machine-- no need to do anything with git inside the devilbox container.

So my workflow is:

  • spin up devilbox
  • be sure I have the latest code from my git repo
  • work on the code with phpstorm [which mirrors into the devilbox folder automatically]
  • run the browser to check my work
  • IF I need to go in the shell (rarely), then fire up the devilbox shell to work inside there

Hope this helps shed some light.

@pnoeric what I did is I made the console inside the docker to use Xdebug.

So I run the tests from inside docker. Of course that allows me to use the debugging features of PhpStorm as the debugger works properly + the internal docker database.

I followed these instructions to set up CLI Xdebug:

1 Like

Thanks! My challenge is getting phpStorm to trigger the tests running inside the docker container. Right now I just manually run phpUnit in a terminal window on the local machine, and/or I suppose I could do it inside the container as well. But configuring phpStorm to be able to do it for me seems nigh impossible :wink:

@pnoeric For me too, but I don’t mind to run them from Devilbox CLI, until we find a solution how to run them from PHPStorm directly.

1 Like