7

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.

apaderno
  • 28,547
  • 16
  • 75
  • 90
Prince Atti
  • 71
  • 1
  • 1
  • 4

1 Answers1

9

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
Jonathan
  • 1,542
  • 3
  • 16
  • 24
  • how do i enter these values sir. i mentioned that i am a new user i cant handel it that easy plz guide me – Prince Atti Apr 29 '18 at 18:11
  • i am using a windows system and downloaded the composer as you mentioned and installed it but the message is same – Prince Atti Apr 29 '18 at 19:38
  • 1
    Hi, that wasnt in the original question, but the same applies (albeit with different commands) unfortunately Im not a windows user, so dont know where composer installs by default on those systems and dont know how to alter the path in the windows terminal – Jonathan Apr 29 '18 at 19:39
  • 1
    thanks a lot sir for your cooperation and time you have given me to resolve the issue i apologize for not mentioning clearly the issue. – Prince Atti Apr 29 '18 at 19:57
  • i can simply make a request that you plz do a favour and search that for me as i am a new beginner of VS code as well as coding and a net user it is difficult for me to find the appropriate solution – Prince Atti Apr 29 '18 at 19:58
  • i have modified the original question with a new complete picture please look at that and then plz check it – Prince Atti Apr 29 '18 at 20:00