sublime-PHP_CodeSniffer icon indicating copy to clipboard operation
sublime-PHP_CodeSniffer copied to clipboard

Step by step guide for Windows users

Open Nirvanatin opened this issue 7 years ago • 1 comments

Please guide me to use this package in windows 10. I have read the issues and solutions for more than 6hrs and I tried them but all fails. is there anyone who can explain every single step to bring this to work. Please explain how to set the path properly, etc.

The below code is the steps that I have done but it fails at the end:

Install phpcs (PHP Code Sniffer) || phpmd || php-cs-fixer by composer for Sublime Text 3 Windows 10

You must have installed PHP and PHP path in System Evironment to install phpcs,phpmd,php-cs-fixer

Install composer: - Go to c:\ and create a folder named bin - Download composer.phar and put it in this folder. - Open cmd, go to c:\bin and run this code: echo @php "%~dp0composer.phar" %*>composer.bat - Add c:\bin to invironment variable.

Install phpcs: run this code: composer require "squizlabs/php_codesniffer=*" ok. phpcs installed.

Install phpmd: run this code: composer require "phpmd/phpmd"

Install php-cs-fixer: open cmd, run this code composer require friendsofphp/php-cs-fixer

Final, add this folder: C:\bin\vendor\bin to System Environment.


Add php-cs-fixer & phpcbf for Sublime Text 3 phpcs: Open Sublime Text 3 -> Preferences -> Package Settings -> PHP Code Sniffer -> Settings --User, add this code: { "phpcbf_executable_path": "C:/bin/vendor/bin/phpcbf.bat", "phpcs_executable_path":"C:/bin/vendor/bin/phpcs.bat", "phpmd_executable_path":"C:/bin/vendor/bin/phpmd.bat", "php_cs_fixer_executable_path":"C:/bin/vendor/bin/php-cs-fixer.bat", }

Nirvanatin avatar Jun 16 '17 20:06 Nirvanatin

Hi, how to install PHP_CodeSniffer without Composer? Use Git Clone instead.

notrealdev avatar Aug 14 '21 12:08 notrealdev