2

How to setup "PHP IntelliSense" on Visual studio code with Laradock to use the PHP binary in the laradock_workspace_1 container?

I have tried to start Remote-containers: attach to running container..., then problem is I can´t access my git repo since its mounted on Windows.

In Windows I can´t access the PHP binary in the docker container, is it possible for vs code to access PHP some remote way(without open a new vs code in the container), so it will have all libraries and modules loaded. This is something I need to get PHP IntelliSense working in correct way? Now some of the autocomplete are not working for example all functions related to Eloquent.

I have found this but unfortunately I don´t understand how to get it work: https://github.com/laradock/laradock/issues/2248

Any other suggestions on how to get autocomplete to work, without install same PHP version in Windows (I don´t want to pollute my system)?

1 Answers1

1

Start with connecting to the Laradock workspace container (Remote-containers) and mount the folder: /var/www/

This will allow you to access the files outside the container.

Then for PHP IntelliSense you should add this line to the settings file:

{
    "php.executablePath": "/usr/local/bin/php"
}

It might be possible to export the port to php-fpm outside the container, but nothing I know how to do. You can also connect to the php-fpm container, but I think the workspace is more practical to connect to.

olle.holm
  • 233
  • 1
  • 4
  • 11
  • 1
    This could also be interesting for you, to make php IntelliSense work even better: https://stackoverflow.com/questions/29439753/eloquent-orm-code-hinting-in-phpstorm – olle.holm Mar 21 '21 at 10:32
  • 1
    The path was wrong php.executablePath but found the correct one: /usr/bin/php – Gustavo Gaviria Mar 21 '21 at 18:27