2017 © Pedro Peláez
 

library laravel-code-style-command

Check code style.

image

lemberg/laravel-code-style-command

Check code style.

  • Tuesday, May 22, 2018
  • by bkhrupa
  • Repository
  • 14 Watchers
  • 1 Stars
  • 316 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 4 % Grown

The README.md

Laravel Code Style Command

This package adds simple artisan command over PHP_CodeSniffer script. Validate PSR2 coding standard in you application., (*1)

Requirements

  • PHP >= 7.0
  • Laravel = 5.5.*|5.8.*

Getting Started

Add the package in your composer.json, (*2)

$ composer require --dev lemberg/laravel-code-style-command

So that's all :), (*3)

Check you code style in app/ directory., (*4)

$ php artisan code-style

Example output:, (*5)

FILE: .../bkhrupa/work/lemberg/laravel-code-style-command/app/User.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 8 | ERROR | [x] Opening brace of a class must be on the line after
   |       |     the definition
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Time: 116ms; Memory: 6Mb

Finished

Advance usage

$ php artisan code-style --help

Config file

Publish code-style.php config file., (*6)

$ php artisan vendor:publish --provider="Lemberg\LaravelCsc\LaravelCscServiceProvider"

Git pre-commit hook

Use git pre-commit hook, (*7)

Add next code to pre commit hooks file .git/hooks/pre-commit., (*8)

#!/bin/bash

`php ./artisan code-style --print-command`

pre-commit hook must be executable, (*9)

$ chmod +x .git/hooks/pre-commit

License

Please see License File for more information., (*10)

The Versions

22/05 2018
06/02 2018
05/02 2018