5
votes

I am new to VS code. I am trying to work with PHP, but I keep getting this notification.

phpcs: Request workspace/configuration failed with message:unable to locate phpcs. please add phpcs to your global path or use composer dependency manager to install it in your project locally.

Intellisense doesn't work for PHP too. I am using a Windows system. I tried to download and install Composer, but I am still getting the problem as shown in the screenshot.

[screenshot]1

I have some extensions installed which are visible in the screenshot, but the issue persists.

1
Did you install phpcs, if so how - RiggsFolly
yes i installed the recommended php extension pack but the msg is again the same - Prince Atti

1 Answers

7
votes

The easiest way is to use composer to install phpcs globally and symlink the binary into your path;

Assuming you have composer installed and are using osx or linux (if not, follow instructions from here: composer) then install phpcs globally: open your terminal and type:

composer global require "squizlabs/php_codesniffer=*"

You will then need to make sure phpcs is in your path. The easiest way is to symlink into /usr/local/bin. open your terminal and type:

sudo ln -s ~/.composer/vendor/bin/phpcs /usr/local/bin/phpcs