New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

lemberg/laravel-code-style-command

Check code style.
5,467 2
Install
composer require lemberg/laravel-code-style-command
Latest Version:2.0.1
PHP:>=7.0.0
Laravel:5
License:MIT
Last Updated:Mar 14, 2019
Links: GitHub  ·  Packagist
Maintainer: bkhrupa

Laravel Code Style Command

This package adds simple artisan command over PHP_CodeSniffer script. Validate PSR2 coding standard in you application.

Requirements

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

Getting Started

Add the package in your composer.json

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

So that's all :)

Check you code style in app/ directory.

$ php artisan code-style

Example output:

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.

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

Git pre-commit hook

Use git pre-commit hook

Add next code to pre commit hooks file .git/hooks/pre-commit.

#!/bin/bash

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

pre-commit hook must be executable

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

License

Please see License File for more information.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

648,266,899 9,701
laravel/framework

The Laravel Framework.

604,216,237 34,982
laravel/tinker

Powerful REPL for the Laravel framework.

512,508,631 7,443
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

429,221,767 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

403,217,078 4,664

Version History

Version Released PHP Laravel License
2.0.1 >=7.0.0 5.5 - 5.8 MIT
2.0.0 >=7.0.0 5.5.*|5.8.* MIT
1.0.1 >=7.0.0 5.4.*|5.5.* Apache-2.0
1.0.0 >=7.0.0 5.4.*|5.5.* Apache-2.0