• Stars
    star
    236
  • Rank 164,924 (Top 4 %)
  • Language
    PHP
  • License
    BSD 3-Clause "New...
  • Created over 9 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Laravel PHP_CodeSniffer

Laravel PHP_CodeSniffer

This is a custom Sniff to detect violations and reformat PHP source code based on Laravel Coding Standard.

Your source code will be checked for PSR-1 & the Laravel "flavor" of PSR-2.

Usage wih git

Clone this repository

git clone http://github.com/antonioribeiro/laravelcs LaravelCodeSniffer

Execute CodeSniffer

phpcs --standard=LaravelCodeSniffer/Standards/Laravel/  /path/to/your/project/files

Usage with Composer

The recommended way is to install it globally with the following command:

composer global require pragmarx/laravelcs

Make sure you have ~/.composer/vendor/bin/ in your PATH.

You will then be able to run PHP Code Sniffer with the Laravel Standard:

phpcs --standard=$HOME/.composer/vendor/pragmarx/laravelcs/Standards/Laravel/ /path/to/your/project/files

Testing the Sniff

This Sniff was tested using the Laravel Framework source code and some changes, to comply with PSR-2, were required, click here to see them. Those were the violations found and fixed in Filesystem.php:

 --------------------------------------------------------------------------------
 FOUND 14 ERRORS AFFECTING 11 LINES
 --------------------------------------------------------------------------------
   29 | ERROR | [x] Inline control structures are not allowed
   44 | ERROR | [x] Inline control structures are not allowed
  113 | ERROR | [x] Expected 1 new line after closing parenthesis; found " "
  113 | ERROR | [x] Expected 1 newline after opening brace; 0 found
  113 | ERROR | [x] Inline control structures are not allowed
  113 | ERROR | [x] Closing brace must be on a line by itself
  241 | ERROR | [x] Inline control structures are not allowed
  247 | ERROR | [ ] Opening brace should be on the same line as the declaration
  249 | ERROR | [x] Closing brace indented incorrectly; expected 2 spaces, found 3
  310 | ERROR | [x] Inline control structures are not allowed
  335 | ERROR | [x] Inline control structures are not allowed
  343 | ERROR | [x] Inline control structures are not allowed
  361 | ERROR | [x] Inline control structures are not allowed
  384 | ERROR | [x] Inline control structures are not allowed
 --------------------------------------------------------------------------------
 PHPCBF CAN FIX THE 13 MARKED SNIFF VIOLATIONS AUTOMATICALLY
 --------------------------------------------------------------------------------

Contributing

There are probably still a lot to do here, so please, open issues and send pull requests.

More Repositories

1

tracker

Laravel Stats Tracker
PHP
2,824
star
2

health

Laravel Health Panel
PHP
1,879
star
3

countries

Laravel countries and currencies
PHP
1,741
star
4

google2fa

A One Time Password Authentication package, compatible with Google Authenticator.
PHP
1,684
star
5

firewall

Firewall package for Laravel applications
PHP
1,362
star
6

google2fa-laravel

A One Time Password Authentication package, compatible with Google Authenticator for Laravel
PHP
825
star
7

tddd

A Laravel Continuous Integration Package
Vue
727
star
8

version

Laravel App versioning
PHP
565
star
9

deeployer

Deploy your Laravel applications via Github or Bitbucket Hooks
PHP
146
star
10

countries-laravel

Countries for Laravel
PHP
141
star
11

yaml

A Laravel YAML parser and config loader
PHP
110
star
12

zipcode

Zip code searcher
PHP
97
star
13

steroids

Laravel 4 Blade on Steroids
PHP
95
star
14

coollection

Laravel Collection Objectified
PHP
87
star
15

google2fa-qrcode

QRCode for Google2FA
PHP
84
star
16

recovery

Create recovery/backup codes for 2FA
PHP
72
star
17

random

Generate random strings or numeric values
PHP
70
star
18

glottos

A PHP 5.3+ Translation/Localization System
PHP
69
star
19

sqli

A Laravel Artisan SQL Interactive Interface
PHP
60
star
20

support

Support Classes
PHP
58
star
21

ia-arr

Laravel Illuminate Agnostic Arr
PHP
49
star
22

ia-str

Laravel Illuminate Agnostic Str
PHP
46
star
23

ia-collection

Laravel Illuminate Agnostic Collection
PHP
43
star
24

artisan-anywhere

Execute Artisan from anywhere in your Laravel project tree
43
star
25

dev-box

Development Box Provisioning in Ansible
Shell
41
star
26

artisan-tool

Nova Artisan Tool
PHP
35
star
27

glottosAdmin

Glottos Admin Panel and Starter
JavaScript
27
star
28

laravel-installer

Laravel Framework Installer Script for Unlix-Like Systems
Shell
26
star
29

google2fa-starter

Google2FA Starter App
PHP
26
star
30

tddd-starter

Laravel TDDD Starter App
PHP
23
star
31

nova-boolean-datetime-field

A Laravel Nova Boolean DateTime field
PHP
20
star
32

skel

A PHP Package Creator & Skeleton
Shell
12
star
33

health-docker

App Health Panel for Docker Environments
PHP
8
star
34

google2fa-php

A One Time Password Authentication PHP class, compatible with Google Authenticator
PHP
6
star
35

lumen-image-processor

Lumen Image Processor
PHP
5
star
36

http-basic-auth

HTTP Basic Auth middleware for Laravel
Shell
3
star
37

trivia

Trivia database
PHP
3
star
38

vanhack-agentbot

Vanhack Agent Bot
PHP
3
star
39

pragmarx.com

Source of pragmarx.com
PHP
3
star
40

zsh

zsh
Shell
3
star
41

backup-server

backup-server
PHP
3
star
42

googleforms

Post to Google Form Spreadsheets
PHP
2
star
43

sdk

sdk
PHP
1
star
44

fluxbb-style

The FluxBB style for the Laravel forums.
1
star
45

core-libraries

core libraries
PHP
1
star
46

veveystore

Vevey Store
HTML
1
star
47

a17ex

Area 17 Exercice
PHP
1
star
48

church.api

Church API
PHP
1
star