You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+54Lines changed: 54 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,6 +104,60 @@ And add scripts, to configure `phpcs` correctly upon `composer install`, like th
104
104
}
105
105
```
106
106
107
+
### Laravel
108
+
109
+
#### Automatic Setup
110
+
111
+
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:
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:
Once more, make sure `phpcs` recognises and uses the installed standards:
146
+
147
+
```bash
148
+
$ phpcs -i
149
+
The installed coding standards are PEAR, Zend, PSR2, MySource, Squiz, PSR1, PSR12 and phpcs-laravel
150
+
```
151
+
152
+
The `--config-show` will give the following output:
153
+
154
+
```bash
155
+
$ phpcs --config-show
156
+
Using config file: /full/path/to/composer/vendor/squizlabs/php_codesniffer/CodeSniffer.conf
157
+
158
+
installed_paths: /full/path/to/phpcs-laravel
159
+
```
160
+
107
161
## Troubleshooting
108
162
109
163
- 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`.)
0 commit comments