Answer the question
In order to leave comments, you need to log in
How well is Docker integrated into PhpStorm?
As I understand it, the same convenient integration into the IDE, as with local php + node, is there no software?
1) php + xdebug started up just with a huge tambourine and garbage in docker-compose.
2) node, as I understand it, will not work at all, so that the npm tab appears with a list of commands from package. And in general, you can forget about any browsersync.
3) The Docker tab only allows you to start/restart/delete containers and images.
Develop the project only by operating in the terminal with the commands docker-compose exec npm watch / docker-compose exec php artisan make:XXX / docker-compose exec php composer require? Or can they be reduced in some way? It was smart enough to just add alias artisan="docker-compose exec php" to bashrc, but this is so-so kmk.
PS: yes, I asked a similar question. But there I described everything crookedly.
Answer the question
In order to leave comments, you need to log in
You can call make
Especially when you need to group several commands
Here is an example, unfortunately someone else's, I still don’t get my hands on Docker properly, Vagrant still covers everything
Example Makefile
Works in Linux like this: make {command}
And then look how many commands make init executes :)
About xdebug, I can say that you are most likely preparing something wrong. It is important to understand that xdebug itself is essentially a client that sends data to the debug server (in this case, it is picked up by PHPStorm). Based on this, we can confidently state that there should be nothing related to debugging in docker-compose at all (the maximum can be attributed here is forwarding the vendor folder, if you need to go through the libraries loaded by the composer in debugging).
How xdebug works: you open a page in the browser, php starts processing it, xdebug looks at its config and, if it sees the connection information (address and port of the debug server), then connects to it, learns about breakpoints and then they interact with each other , but the connection is raised by php, that is, it goes from the container to the host, no ports need to be forwarded, since your host is always visible from the container.
I put in the config xdebug.remote_connect_back=on
, then you do not need to specify it xdebug.remote_host
and it looks for the server on the ip from which the page was opened. True, you can’t debug cli in this way, but you can also get the host’s ip-shnik somehow, you can google it if you really want to.
Let's say you have the following written in xdebug.ini:
zend_extension=xdebug.so
xdebug.remote_enable=on
xdebug.remote_autostart=on
xdebug.remote_connect_back=on
xdebug.remote_port=9999
Advanced settings
uncheck Notify if debug session was finished without being pausedserver_name
nginx (I did not configure other proxies) {
"name": "Listen for XDebug in Docker",
"type": "php",
"request": "launch",
"port": 9999,
"pathMappings": {
"Абсолютный путь к папке проекта в контейнере": "${workspaceRoot}"
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question