Skip to content

Commit f53465e

Browse files
authored
Update README.md
1 parent 3fc0934 commit f53465e

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

README.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,29 @@ And add scripts, to configure `phpcs` correctly upon `composer install`, like th
100100

101101
### Laravel
102102

103-
#### Setup Laravel Standards (Manual)
103+
#### Automatic Setup
104+
105+
Here, you can also use [PHP_CodeSniffer Standards Composer Installer Plugin](https://github.com/Dealerdirect/phpcodesniffer-composer-installer) to automatically link the Laravel standards to phpcs. Again, make sure `phpcs` is installed locally and so our `pre-commit`. We just need to require [emielmolenaar/phpcs-laravel](https://github.com/emielmolenaar/phpcs-laravel) package and we are done:
106+
107+
```bash
108+
composer require --dev emielmolenaar/phpcs-laravel
109+
```
110+
111+
Finally, add the same scripts to configure `phpcs` correctly upon `composer install`:
112+
113+
```json
114+
"scripts": {
115+
"install-codestandards": [
116+
"Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run"
117+
],
118+
"post-install-cmd": [
119+
"php-pre-commit",
120+
"@install-codestandards"
121+
]
122+
}
123+
```
124+
125+
#### Manual Setup
104126

105127
A Laravel's coding standard repository that is being updated consistently is [emielmolenaar/phpcs-laravel](https://github.com/emielmolenaar/phpcs-laravel). We will now proceed to the configuration (very similar to the *WordPress configuration*). First clone [emielmolenaar/phpcs-laravel](https://github.com/emielmolenaar/phpcs-laravel) repository:
106128

@@ -130,32 +152,10 @@ Using config file: /full/path/to/composer/vendor/squizlabs/php_codesniffer/CodeS
130152
installed_paths: /full/path/to/phpcs-laravel
131153
```
132154

133-
#### Alternative (Automatic)
134-
135-
Here, you can also use [PHP_CodeSniffer Standards Composer Installer Plugin](https://github.com/Dealerdirect/phpcodesniffer-composer-installer) to automatically link the Laravel standards to phpcs. Again, make sure `phpcs` is installed locally and so our `pre-commit`. We just need to require [emielmolenaar/phpcs-laravel](https://github.com/emielmolenaar/phpcs-laravel) package and we are done:
136-
137-
```bash
138-
composer require --dev emielmolenaar/phpcs-laravel
139-
```
140-
141-
Finally, add the same scripts to configure `phpcs` correctly upon `composer install`:
142-
143-
```json
144-
"scripts": {
145-
"install-codestandards": [
146-
"Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run"
147-
],
148-
"post-install-cmd": [
149-
"php-pre-commit",
150-
"@install-codestandards"
151-
]
152-
}
153-
```
154-
155155
## Troubleshooting
156156

157157
- If the script is not executable, run the following, where the path is to the composer executable. (If installed globally it should be in `~/.composer/vendor/bin`, otherwise it's in the folder that contains `composer.json`.)
158158

159-
```bash
160-
chmod +x vendor/bin/php-pre-commit
161-
```
159+
```bash
160+
chmod +x vendor/bin/php-pre-commit
161+
```

0 commit comments

Comments
 (0)