A PHP-CS-Fixer bridge for use via Artisan CLI on Laravel 5.5+

2.1.0 2020-03-10 09:46 UTC

This package is auto-updated.

Last update: 2024-05-29 03:57:00 UTC


GitHub license Maintenance GitHub release (latest by date) GitHub stars Packagist

This package allows to use PHP-CS-Fixer right into Laravel 5.5+ applications to format PHP code.


Full documentation is available at

Quick start

Install this package using Composer.

$ composer require bgaze/laravel-php-cs-fixer

To customize the configuration, publish it:

$ php artisan vendor:publish --tag=bgaze-php-cs-fixer-config

Notes : Configuration returns an instance of \PhpCsFixer\Config and will be published into a .php_cs.dist file at the Laravel installation root.

Use php-cs-fixer:fix artisan command to fix files in your application:

$ php-cs-fixer:fix [options] path1 [path2 path3 ...]

Use php_cs_fixer() helper to fix files from the code:

// Quick.

// Advanced.
php_cs_fixer(['path/to/file/or/dir/1', 'path/to/file/or/dir/2'], [
    '--allow-risky' => true,
    '--dry-run' => true,
    '--config' => 'path/to/a/config/file'