noitran / cs-fixer-command
Lumen/Laravel wrapper around PHPCS-Fixer package. Used as artisan command.
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 1
Open Issues: 0
pkg:composer/noitran/cs-fixer-command
Requires
- php: >=7.2
 - friendsofphp/php-cs-fixer: ^2.14
 - illuminate/support: ^6.0
 
Requires (Dev)
- illuminate/console: ^6.0
 - mockery/mockery: ~1.0
 - orchestra/testbench: ~3.4.2|~3.5.0|~3.6.0|~3.7.0
 - phpunit/phpunit: ~7.0
 
This package is auto-updated.
Last update: 2025-10-08 12:10:42 UTC
README
About
Lumen/Laravel wrapper around PHPCS-Fixer package that allows, using artisan command, easly apply pre-defined coding standards to your laravel or lumen project.
Wrapper uses PHP Coding Standards Fixer package
List of all fixer rules can be found here
Features
- Adds console command 
php artisan phpcs:fixthat fixes your project to follow standards defined in yourconfig/phpcs.php - Adds command to install pre-commit git hook 
php artisan phpcs:install-hook. After install phpcs:fix will be triggered before each commit and will auto fix your code 
Install
- Install as composer package
 
$ composer require noitran/cs-fixer-command
Laravel
- Laravel uses provider auto discovery. Config file can be published using command
 
$ artisan vendor:publish --provider="Noitran\CsFixer\CsFixerServiceProvider"
Lumen
- Open your bootstrap/app.php and register as service provider
 
$app->register(Noitran\CsFixer\CsFixerServiceProvider::class);
- Config file should be loaded manually in bootstrap/app.php
 
$app->configure('phpcs');
Usage
- 
Publish
phpcsand change if necessary, run command for inspectionphp artisan phpcs:fix - 
Hook installation can be done using command
php artisan phpcs:install-hook - 
Hook install command can be added into
composer.jsonas post-install command, so that, at example, other team members will get pre-commit hook when installing composer dependencies at first time. 
Example: Adding as composer post-install command
{
    "name": "laravel/lumen",
    "require": {
        ...
    },
    "autoload": {
        ...
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan phpcs:install-hook"
        ],
        "post-update-cmd": [
            ...
        ]
    }
}