Package Data | |
---|---|
Maintainer Username: | smazurov |
Maintainer Contact: | support@socialengine.com (SocialEngine Development Team) |
Package Create Date: | 2014-09-15 |
Package Last Update: | 2017-09-29 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-01-13 15:12:55 |
Package Statistics | |
---|---|
Total Downloads: | 48,167 |
Monthly Downloads: | 3 |
Daily Downloads: | 0 |
Total Stars: | 12 |
Total Watchers: | 16 |
Total Forks: | 4 |
Total Open Issues: | 0 |
This is a Laravel 5 package that hooks up SquizLabs CodeSniffer 2 into Laravel-based apps. It can also be used manually, so read on.
Detect violations of a defined coding standard. It helps your code remain clean and consistent. Available options are: PSR2, PSR1, Zend, PEAR, Squiz, PHPCS and SocialEngine.
Require this package in composer:
$ composer require socialengine/sniffer-rules
In your config/app.php
add 'SocialEngine\SnifferRules\ServiceProvider'
to $providers
array:
'providers' => [
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider',
'SocialEngine\SnifferRules\ServiceProvider',
],
$ php artisan vendor:publish
Install our Standard by configuring PHP_CodeSniffer to look for it.
$ php ./vendor/bin/phpcs --config-set installed_paths ./vendor/socialengine/src/Socialengine/SnifferRules/Standard/
$ php artisan sniff
To run the sniffer in a CI environment, the -n
option should be set to remove
interaction:
$ php artisan sniff -n
$ php ./vendor/bin/phpcs --standard=SocialEngine path/to/code
It's encouraged to add a Makefile
to your project that makes it
trivial for other developers. Use Makefile
in this directory and adjust as
needed to fit your project requirements.
In combination with the Makefile
, Travis has issues finding the
standard, we had to add a before_script
to make it work. See
Unum repo for example.
before_script: php ./vendor/bin/phpcs --config-set installed_paths "`pwd`/vendor/socialengine/sniffer-rules/src/SocialEngine/SnifferRules/Standard/"
namespace
should be on the same line as opening php tag. e.g.: <?php namespace SocialEngine\Amazing
test_cats_love_catnip
MIT