Skip to content

kartikkapatel/php-style

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PHP CS Fixer - Laravel Coding Style Ruleset

This package allows you to use the set of rules for PHP CS Fixer created and recommended by Laravel Shift.

You can find the original and official source of the ruleset in this gist.

Installation

You can install the ruleset via composer using the following command:

composer require --dev kartikkapatel/php-style

This package will also require the friendsofphp/php-cs-fixer package.

Usage

This package only gives you easy access to the recommended ruleset. The common and usual PHP-CS-Fixer setup is still required:

In case you don't have one, create your .php_cs.dist file in project root folder.

touch .php_cs.dist

Put your Finder config inside. This will tell PHP-CS-Fixer where to run.

Usually, for a Laravel Project this is the config:

<?php

$finder = PhpCsFixer\Finder::create()
  ->in([
    __DIR__.'/app',
    __DIR__.'/config',
    __DIR__.'/database',
    __DIR__.'/resources',
    __DIR__.'/routes',
    __DIR__.'/tests',
  ])
  ->name('*.php')
  ->notName('*.blade.php')
  ->ignoreDotFiles(true)
  ->ignoreVCS(true);    

return PhpStyleFixer\styles($finder);               

Run your fixer.

./vendor/bin/php-cs-fixer fix

Run on CI

./vendor/bin/php-cs-fixer fix --dry-run

Resources

About

PHP style rules for PHP-CS-Fixer.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages