Skip to content

Commit 237cf3d

Browse files
committed
Improve the documentation on what is needed.
1 parent 5e2f42d commit 237cf3d

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,39 @@ StellarWP coding standards uses a combination of:
1414
> composer global require "squizlabs/php_codesniffer=3.4.2"
1515
> ```
1616
17+
## Complete Installation Script
18+
19+
For a full installation of all required components, you can use the following script. This will install all necessary packages globally and configure PHPCS to use them:
20+
21+
```bash
22+
#!/bin/bash
23+
24+
# Install PHP_CodeSniffer
25+
composer global require "squizlabs/php_codesniffer=^3.8.0"
26+
27+
# Install required coding standards and dependencies
28+
composer global require "wp-coding-standards/wpcs:^3.0.0"
29+
composer global require "automattic/vipwpcs:^3.0"
30+
composer global require "phpcsstandards/phpcsextra:*"
31+
composer global require "phpcsstandards/phpcsutils:*"
32+
composer global require "stellarwp/coding-standards:*"
33+
composer global require "sirbrillig/phpcs-variable-analysis:*"
34+
composer global require "slevomat/coding-standard:^8.14.0"
35+
36+
# Update PHPCS installed paths to include all standards
37+
phpcs --config-set installed_paths "$(phpcs --config-show | grep installed_paths | awk '{ print $2 }'),${HOME}/.config/composer/vendor/phpcsstandards/phpcsextra,${HOME}/.config/composer/vendor/phpcsstandards/phpcsutils,${HOME}/.config/composer/vendor/wp-coding-standards/wpcs,${HOME}/.composer/vendor/automattic/vipwpcs,${HOME}/.composer/vendor/stellarwp/coding-standards,${HOME}/.composer/vendor/sirbrillig/phpcs-variable-analysis,${HOME}/.composer/vendor/slevomat/coding-standard"
38+
39+
# Verify installation
40+
echo "Installed PHPCS version:"
41+
phpcs --version
42+
echo ""
43+
echo "Installed coding standards:"
44+
phpcs -i
45+
```
46+
47+
> [!NOTE]
48+
> The script assumes your global Composer binaries are in your PATH. Adjust the paths in the script if your Composer global installation directory is different.
49+
1750
## Setup on PHPStorm
1851

1952
You can follow [this guide](https://confluence.jetbrains.com/display/PhpStorm/PHP+Code+Sniffer+in+PhpStorm#PHPCodeSnifferinPhpStorm-4.1.Obtainingcustomcodestyles) the only step you can replace is the one on **Installing via Composer** by the one above to install the 3.4.2 version instead.

0 commit comments

Comments
 (0)