Skip to content

pltrm/PHP-Coding-Style-Guide

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Coding Style Guide

Guide

See Code Style Guide for more details.

Fix code style

To manage code style, use PHP-CS-Fixer.

composer require "ba/php-cs"

Add the file .php-cs-fixer.dist.php to the root folder of the project:

<?php
use PhpCsFixer\Finder;
use function BACodeStyle\styles;

$finder = (new Finder())->in([
    __DIR__.'/src'
]);

$config = styles($finder);

return $config
    ->setUsingCache(true)
    ->setCacheFile(__DIR__.'/.php-cs-fixer.cache');

Add PHP-CS-Fixer temporary files to git ignore (.gitignore):

+.php-cs-fixer.php
+.php-cs-fixer.cache

Run fixer:

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

About

PHP Coding Style Guide

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%