Download the PHP package mreduar/laravel-phpcs without Composer
On this page you can find all versions of the php package mreduar/laravel-phpcs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mreduar/laravel-phpcs
More information about mreduar/laravel-phpcs
Files in mreduar/laravel-phpcs
Package laravel-phpcs
Short Description PHP Codesniffer ruleset to follow Laravel's coding style
License MIT
Homepage https://github.com/mreduar/laravel-phpcs
Informations about the package laravel-phpcs
PHP Codesniffer ruleset to follow Laravel's coding style
php codesniffer ruleset for laravel or any other php projects.
Installation
*[]** Install using composer
*[]** Install manually
- Copy the
phpcs.xml
file into your project root. - Descoment lines
<file>app</file>
and the others inphpcs.xml
file. - Because this package uses third party standards that are not in phpcs you need to install these package.
composer require slevomat/coding-standard
- Run
phpcs .
to check your project.
Usage
Enabling the rules
Only neccesary if you installed as a package using composer!
php artisan vendor:publish --provider="Mreduar\LaravelPhpcs\LaravelPhpcsServiceProvider" --tag="ruleset"
This will publish to your root directory the following file
Optionally you can also publish a git hook that will help you to never overlook smelly code.
php artisan vendor:publish --provider="Mreduar\LaravelPhpcs\LaravelPhpcsServiceProvider" --tag="hook"
The file will be published in its root directory .git/hooks/pre-commit
So every time you try to commit phpcs
will first check that you have everything correct.
if you have any errors the commit will be cancelled.
Sniffing code
Use php CodeSniffer commands, pointed towards your xml file, to sniff the code using the new ruleset.
vendor/bin/phpcs
vendor/bin/phpcbf
Sniffing code in PHPStorm
See PHP Code Sniffer in PhpStorm on how to set up CodeSniffer in PHPStorm.
Sniffing code Visual Studio Code
See PHP Sniffer by wongjn or other phpcs plugins for more information about PHP Code Sniffer in Visual Studio Code.
Contributing
All changes that makes the sniffer more accurate towards Laravel's coding standard is always highly appreciated and welcome.
Please see CONTRIBUTING for more details.
Credits
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-phpcs with dependencies
slevomat/coding-standard Version ^8.0
squizlabs/php_codesniffer Version ^3.7