PHPStorm with Composer and Remote Debug

Answered

 I understand that JetBrains still haven't added any support for those of us trying to do remote debugging (xDebug) on projects involving packages that like Composer (eg. Silex).

However, that doesn't mean to say that it can't be done.

Are there any guides/videos that I should look at to give an example of how I might manually do the Composery bits in a manner that would work with xDebug inside PHPStorm?


Cheers!

0
4 comments

Hi there,

Sorry, but it's unclear (at least for me) what exactly you wish to know.

But in short:

1) Remote composer (executing composer tasks using remote interpreter) is not yet supported

2) Debugging remote PHP code works -- regardless if website uses composer for dependency management/autoloading or not.

Right now I do not see how Composer is related to debugging of already established/working web site.

0
Avatar
Permanently deleted user

Within point 2 - I'd like to see someone run through how they get around the lack of point 1!

eg. I'm developing some code on PHPStorm running on a windows machine, but the project files are on a linux drive shared by samba.

If I run composer on the samba machine to install libraries, will it put them somewhere that PHPStorm can see - there may be some extra mappings that need to be set up for libraries outside of the project directory?

The development we're talking about will begin life as nothing, so there's no "already established/working web site" but I'd like to exercise good practice. 

0

Well .. speaking in general:

1) You need to have local copy of all remote files that you wish to debug or step in

2) Remote location does not matter -- composer managed files can be located anywhere on that system

3) Locally -- those files can also be located anywhere:

4) For debugging you will have provide path mappings so that IDE knows what remote file corresponds to local one (other way around actually .. as local files are considered the source (important ones))

5) Such path mappings are set at "PHP | Servers": left column -- local path; right column -- remote (https://www.jetbrains.com/help/phpstorm/2016.3/servers.html?search=Servers)

6) No need to map every single file -- child folders/files will inherit paths from parent

7) The key notes here:

  • you need to provide mappings for every located-elsewhere folder. In general -- one mapping for project root might be enough but subfolders may have different mappings; each "include path" will have own mapping.
  • remote paths must be final/resolved paths .. as xdebug works with such paths only. So no symbolic links -- only resolved ones.

Root doc entry for PHP debugging: https://confluence.jetbrains.com/display/PhpStorm/Debugging+with+PhpStorm (has videos and stuff)

0
Avatar
Permanently deleted user

Thanks, Andriy, that looks very helpful.

I think I may be overly concerned about the lack of Composer Integration ;-)

0

Please sign in to leave a comment.