PHPackages                             chefsplate/sniffer-rules - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. chefsplate/sniffer-rules

ActiveLibrary[CLI &amp; Console](/categories/cli)

chefsplate/sniffer-rules
========================

A Laravel 4 and Laravel 5 SquizLabs Code Sniffer 2.0 artisan command. Detect violations of a defined coding standard. It helps your code remains clean and consistent.

1.0.0(8y ago)32.5k[6 issues](https://github.com/chefsplate/sniffer-rules/issues)MITPHPPHP &gt;=5.4.0

Since Jul 5Pushed 8y ago3 watchersCompare

[ Source](https://github.com/chefsplate/sniffer-rules)[ Packagist](https://packagist.org/packages/chefsplate/sniffer-rules)[ Docs](https://github.com/chefsplate/sniffer-rules)[ RSS](/packages/chefsplate-sniffer-rules/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

phpcs 2.0+ Laravel 4/5 Command
==============================

[](#phpcs-20-laravel-45-command)

[![Build Status](https://camo.githubusercontent.com/b8adab99bd65e7d01f1252a33fb08068dda953f20d6c0a51585c3155b65309bb/68747470733a2f2f7472617669732d63692e6f72672f4368656673506c6174652f736e69666665722d72756c65732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ChefsPlate/sniffer-rules)[![Latest Stable Version](https://camo.githubusercontent.com/63222427a6d3085579db30fbcfc63bb823c9605cb18ced5957d459dae16b616c/68747470733a2f2f706f7365722e707567782e6f72672f4368656673506c6174652f736e69666665722d72756c65732f76657273696f6e2e706e67)](https://packagist.org/packages/ChefsPlate/sniffer-rules)[![License](https://camo.githubusercontent.com/39ee31919f1def2e15d2418730bb77fa501f9cf5e0f11f2465bee12c3f5b4d7b/68747470733a2f2f706f7365722e707567782e6f72672f4368656673506c6174652f736e69666665722d72756c65732f6c6963656e73652e737667)](https://packagist.org/packages/ChefsPlate/sniffer-rules)

This is a [Laravel](http://laravel.com/) 4/5 package that hooks up [SquizLabs CodeSniffer 2](https://github.com/squizlabs/PHP_CodeSniffer)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 **ChefsPlate**.

### Setup

[](#setup)

Require this package in composer:

```
$ composer require chefsplate/sniffer-rules

```

#### Laravel 4/5

[](#laravel-45)

In your `config/app.php` add `ChefsPlate\SnifferRules\ServiceProvider:class`to `$providers` array:

```
'providers' => [
    ...

    ChefsPlate\SnifferRules\ServiceProvider::class,

    ...
],
```

#### Laravel 5: Publish the configuration file

[](#laravel-5-publish-the-configuration-file)

```
$ php artisan vendor:publish
```

#### Laravel 4: Manually create config

[](#laravel-4-manually-create-config)

Copy [config](src/ChefsPlate/SnifferRules/config/config.php) to `app/config/sniffer-rules.php`

Edit configuration file `config/sniffer-rules.php` to tweak the sniffer behavior.

#### Manual

[](#manual)

Install our *Standard* by configuring **PHP\_CodeSniffer** to look for it.

```
$ php ./vendor/bin/phpcs --config-set installed_paths ./vendor/chefsplate/src/ChefsPlate/SnifferRules/Standard/
```

### Usage

[](#usage)

#### Laravel

[](#laravel)

```
$ php artisan sniff
```

To run the sniffer in a CI environment, the `-n` option should be set to remove interaction:

```
$ php artisan sniff -n

```

#### Manual

[](#manual-1)

```
$ php ./vendor/bin/phpcs --standard=ChefsPlate path/to/code
```

It's encouraged to add a [`Makefile`](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.

ChefsPlate Coding Standards
---------------------------

[](#chefsplate-coding-standards)

### Coding standards

[](#coding-standards)

- [PSR 2 Coding Style Guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)
- [PSR 1 Coding Standards](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md)
- [PSR 0 Coding Standards](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md)

#### Addendum and Clarifications

[](#addendum-and-clarifications)

- `namespace` should be on the same line as opening php tag. e.g.: `
