- Install Composer - https://getcomposer.org/Composer-Setup.exe
- ℹ️ You may need to enable OpenSSL in your PHP installation by going directly to
./wamp/bin/php/php-5.x.x/php.ini
and enabling the OpenSSL extension
- These instructions assume you have WAMP installed already in order to provide your technology stack
- To install globally the necessary Composer packages paste this command into a terminal and hit Enter ↵
- ℹ️ The openssl extension must be enabled within
php.ini
of the PHP build you are using with the command line
- (Start → Run → Type:
cmd
to open a command prompt)
- Add
C:\Users\%USERNAME%\AppData\Roaming\Composer\vendor\bin
to the PATH
System Variable
- Start → Run →
control sysdm.cpl,,3
→ Environment Variables
- To check your installation is configured properly, open a terminal and type in
composer --version
- This should return something similar to
Composer version 1.6.5 2018-05-04 11:44:59
- Download and extract
coding-standards/PHP/CodeSniffer/CustomPHPCS
and place at C:\Users\%USERNAME%\Documents\
- ℹ️ Remember to unzip the zipped content!
- Go to the root of the project you want to sniff and open a command prompt (not Git Bash)
- (Start → Run → Type:
cmd
to open a command prompt)
- Optionally, change the period (at the end) to scan against whatever folder/file name you like
del "phpcs-report.txt" 2>NUL & phpcs -s --colors -d memory_limit=1G --ignore=*/vendor/* --extensions=php --report-file="phpcs-report.txt" --standard="C:/Users/%USERNAME%/Documents/CustomPHPCS" .
- PHP Code Beautifier (PHPCBF) can be run to automatically fix the errors detailed in the report. In the report an
[x]
will denote which errors it can fix.
phpcbf -n -d memory_limit=1G --ignore=*/vendor/* --extensions=php --standard="C:/Users/%USERNAME%/Documents/CustomPHPCS" .
- To fix only a specific sniff use the following command.
phpcbf -n -d memory_limit=1G --ignore=*/vendor/* --extensions=php --standard="C:/Users/%USERNAME%/Documents/CustomPHPCS" --sniffs="CustomPHPCS.Strings.ConcatenationSpacing" .
- Go to the root of the project you want to mess detect and open a command prompt (not Git Bash)
- (Start → Run → Type:
cmd
to open a command prompt)
- Optionally, change the period to scan against whatever folder/file name you like
phpmd . html "C:/Users/%USERNAME%/Documents/phpmd-ruleset.xml" > phpmd-report.html
Checking Code for PHP 7 Compatibility