How do I fix the following phpcs error in Visual Studio Code?
Asked Answered
V

1

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.

Vent answered 28/4, 2018 at 15:51 Comment(2)
Did you install phpcs, if so howPooh
yes i installed the recommended php extension pack but the msg is again the sameVent
T
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
Treehopper answered 28/4, 2018 at 16:48 Comment(6)
how do i enter these values sir. i mentioned that i am a new user i cant handel it that easy plz guide meVent
i am using a windows system and downloaded the composer as you mentioned and installed it but the message is sameVent
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 terminalTreehopper
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.Vent
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 solutionVent
i have modified the original question with a new complete picture please look at that and then plz check itVent

© 2022 - 2024 — McMap. All rights reserved.