Skip to content

Commit adb06ef

Browse files
committed
docs(README): Add local composer installation example and removed installer plugin section that is now done automatically (#3260071)
1 parent ea82273 commit adb06ef

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

README.md

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ please use [ESLint](http://eslint.org/) and see the
1616
[Drupal ESLint](https://www.drupal.org/node/1955232) documentation.
1717

1818

19-
## Installation
19+
## Global installation
2020

2121
First, make sure Composer is installed correctly:
2222

@@ -25,33 +25,15 @@ First, make sure Composer is installed correctly:
2525
If you get composer not found or similar, follow Composer's installation
2626
instructions.
2727

28-
Install Coder (8.x-3.x) in your global Composer directory in your home directory
29-
(`~/.composer`):
28+
Install Coder (8.3.x) in your global Composer directory in your home directory
29+
(`~/.config/composer`):
3030

3131
composer global require drupal/coder
3232

3333
To make the `phpcs` and `phpcbf` commands available globally, add the Composer
3434
bin path to your `$PATH` variable in `~/.profile`, `~/.bashrc` or `~/.zshrc`:
3535

36-
export PATH="$PATH:$HOME/.composer/vendor/bin"
37-
38-
39-
### Composer Installer Plugins
40-
41-
The Coder package (>= 8.2.11) now works with Composer Installer Plugins,
42-
that find and register standards whenever packages are installed or updated.
43-
To use such a plugin within your project, follow these steps.
44-
45-
composer require --dev drupal/coder
46-
47-
Now, you will see Drupal and DrupalPractice listed in the available PHP
48-
CodeSniffer standards.
49-
50-
vendor/bin/phpcs -i
51-
52-
The same can be done for a Composer global installation.
53-
54-
composer global require drupal/coder
36+
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
5537

5638

5739
## Usage
@@ -69,6 +51,21 @@ Automatically fix coding standards
6951
phpcbf --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml /file/to/drupal/example_module
7052

7153

54+
## Local installation in your Drupal project
55+
56+
For collaborating developer teams it makes sense to lock a Coder version with
57+
your other development dependencies locally. In your project where you have your
58+
composer.json file execute this:
59+
60+
composer require --dev drupal/coder
61+
62+
Then you can run Coder on your custom module code like this:
63+
64+
./vendor/bin/phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml web/modules/custom
65+
66+
To simplify execution it is highly recommended to use a settings file, see below.
67+
68+
7269
## Store settings in a phpcs.xml.dist file
7370

7471
In order to save and commit your PHPCS settings to Git you can use a
@@ -104,7 +101,9 @@ phpcs.xml.dist file in your project like this:
104101

105102
Then you can invoke phpcs without any options and it will read phpcs.xml.dist
106103
from the current directory. This can also be useful for Continuous Integration
107-
setups.
104+
setups. Example:
105+
106+
./vendor/bin/phpcs -p
108107

109108

110109
## Working with Editors

0 commit comments

Comments
 (0)