fullsmack/php-cs-fixer-breathe
Composer 安装命令:
composer require fullsmack/php-cs-fixer-breathe
包简介
Breathe - Custom PHP-CS-Fixer configuration with FullSmack coding standards
README 文档
README
Custom PHP-CS-Fixer configuration package with custom fixers and rulesets for FullSmack coding standards.
Features
This package provides:
- Custom Fixers: Custom fixers mainly for specific brace positioning
- Custom RuleSet: Pre-configured
@fullsmack/breatheruleset based on PSR-12 - Easy Integration: Simple to use in your projects
Installation
Install via Composer:
composer require --dev fullsmack/php-cs-fixer-breathe
Usage
Quick Start
Create a .php-cs-fixer.dist.php file in your project root:
<?php require_once __DIR__ . '/vendor/autoload.php'; $finder = PhpCsFixer\Finder::create() ->in(__DIR__) ->exclude('var') ->exclude('vendor') ->exclude('node_modules'); $config = \FullSmack\PhpCsFixerBreathe\Config::create(); return $config->setFinder($finder);
Manual Configuration
For more control, you can manually configure:
<?php require_once __DIR__ . '/vendor/autoload.php'; use FullSmack\PhpCsFixerBreathe\Fixer; use FullSmack\PhpCsFixerBreathe\RuleSet; $finder = PhpCsFixer\Finder::create() ->in(__DIR__) ->exclude('var') ->exclude('vendor'); $config = new PhpCsFixer\Config(); return $config ->registerCustomFixers([ new Fixer\MatchBraceSameLine(), new Fixer\TryBraceSameLine(), new Fixer\CatchOnNewLine(), new Fixer\ElseOnNewLine(), new Fixer\EmptyCatchBodySameLine(), new Fixer\MethodReturnTypeBraceRegex(), ]) ->registerCustomRuleSets([ new RuleSet\Breathe(), ]) ->setRules([ '@fullsmack/breathe' => true, // Override or add additional rules here ]) ->setFinder($finder);
Extending the RuleSet
You can use the @Breathe ruleset as a base and override specific rules:
<?php $config = \FullSmack\PhpCsFixerBreathe\Config::create(); return $config ->setRules([ '@fullsmack/breathe' => true, 'no_unused_imports' => true, // Override default 'ordered_imports' => [ 'imports_order' => ['class', 'function', 'const'], ], ]) ->setFinder($finder);
Custom Fixers
This package includes the following custom fixers:
Fullsmack/match_brace_same_line
Ensures match expression opening braces are on the same line.
Fullsmack/try_brace_same_line
Ensures try block opening braces are on the same line.
Fullsmack/catch_on_new_line
Places catch statements on a new line after the closing brace of the try block.
Fullsmack/else_on_new_line
Places else statements on a new line after the closing brace of the if block.
Fullsmack/empty_catch_body_same_line
Handles formatting of empty catch blocks.
Fullsmack/method_return_type_brace_regex
Applies regex-based formatting for method return type braces.
The @fullsmack/breathe RuleSet
The @fullsmack/breathe ruleset extends @PSR12 with additional rules:
- Custom brace positioning for control structures and functions
- Specific import handling
- Trailing comma requirements in multiline arrays and parameters
- And more...
See src/RuleSet/Breathe.php for the complete list of rules.
Running PHP-CS-Fixer
After creating your configuration file:
# Dry run (show what would be fixed) vendor/bin/php-cs-fixer fix --dry-run --diff # Fix files vendor/bin/php-cs-fixer fix # Fix specific directory vendor/bin/php-cs-fixer fix src/
Requirements
- PHP 8.1 or higher
- PHP-CS-Fixer 3.92 or higher
License
MIT
Contributing
Contributions are welcome! Please submit pull requests or open issues on GitHub.
fullsmack/php-cs-fixer-breathe 适用场景与选型建议
fullsmack/php-cs-fixer-breathe 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「fixer」 「ruleset」 「php-cs-fixer」 「code-style」 「coding-standards」 「Breathe」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 fullsmack/php-cs-fixer-breathe 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fullsmack/php-cs-fixer-breathe 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 fullsmack/php-cs-fixer-breathe 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
HiDev plugin for PHP-CS-Fixer
Custom configuration for PHP CS Fixer used by Serendipity HQ.
Taptima PHP-CS-Fixer fixers
Fixing php code style
Coding styles rules and git hook for NAIS Based Applications
Jeux de règles pour PHP Mess Detector.
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 28
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-24