ivang11 / php-style
PHP style rules for PHP-CS-Fixer
1.1.1
2020-06-23 23:40 UTC
Requires
- php: ^7.2
- friendsofphp/php-cs-fixer: ^2.8
This package is auto-updated.
Last update: 2025-03-24 10:19:24 UTC
README
These are the rules applied across all my projects.
Installation
You can install using composer from Packagist.
composer require ivang11/php-style --dev
Usage
In your .php_cs.dist
config file
<?php // specify the paths to fix $finder = PhpCsFixer\Finder::create() ->notPath('bootstrap/*') ->notPath('storage/*') ->notPath('vendor') ->in([ __DIR__ . '/app', __DIR__ . '/tests', __DIR__ . '/database', ]) ->name('*.php') ->notName('*.blade.php') ->ignoreDotFiles(true) ->ignoreVCS(true); // then call and return the following style function return Ivang11\styles($finder);
Create alias for command
Set the command in composer.json
"scripts": { "format": [ "vendor/bin/php-cs-fixer fix" ], }
Execute the command
composer format
Execute on CI
./vendor/bin/php-cs-fixer fix --dry-run
Resources
- Sharing PHP-CS-Fixer rules across projects and teams. Laravel News Article
- Laravel Shift Recommended Coding Ruleset. Gist - Shift
License
The MIT License (MIT). Please see License File for more information.