Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code: Unable to locate phpcs

I am facing this issue in Visual Studio Code. I have already tried reinstalling the phpcs extension but still facing this issue.

this is the image

Unable to locate phpcs

Please add phpcs to your global path or use the composer dependency manager to install it in your project locally in Visual studio Code

like image 978
Monika Rani Avatar asked Nov 08 '17 07:11

Monika Rani


People also ask

What is Phpcs?

PHPCS is a tool that helps detect violations of pre-defined coding standards. It also includes an additional tool that can automatically correct those violations.


Video Answer


2 Answers

I had the same issue, I did the following to fix it:

  1. Install the phpcs by using composer with composer global require squizlabs/php_codesniffer

  2. Press Command + , (Click Code -> Preferences -> Settings)

  3. Select User Settings and locate 'PHP CodeSniffer'
  4. Scroll to 'Executatble Path' and put

    /Users/your-username/.composer/vendor/bin/phpcs

This fixed the issue for me, I hope it does for you too. Cheers!

like image 51
Jekayode Avatar answered Sep 26 '22 05:09

Jekayode


open the project in the terminal and run this command

composer global require squizlabs/php_codesniffer 

Hope that helps!

like image 23
Cengkuru Michael Avatar answered Sep 23 '22 05:09

Cengkuru Michael