bgaze/laravel-php-cs-fixer

PHP-CS-Fixer的Laravel 5.5+ Artisan CLI桥接器

2.1.0 2020-03-10 09:46 UTC

This package is auto-updated.

Last update: 2024-09-29 04:43:19 UTC


README

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

此包允许在Laravel 5.5+应用程序中使用PHP-CS-Fixer来格式化PHP代码。

文档

完整文档可在https://packages.bgaze.fr/laravel-php-cs-fixer找到。

快速开始

使用Composer安装此包。

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

为了自定义配置,将其发布

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

注意:配置返回一个\PhpCsFixer\Config实例,并将发布到Laravel安装根目录下的.php_cs.dist文件。

使用php-cs-fixer:fix artisan命令修复应用程序中的文件

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

使用php_cs_fixer()助手从代码中修复文件

// Quick.
php_cs_fixer('path/to/a/file/or/dir');

// 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'
]);