matraux/php-code-style
最新稳定版本:1.0.0
Composer 安装命令:
composer require matraux/php-code-style
包简介
A PHP 8.3+ library providing reusable PHP-CS-Fixer rules and shared code style configuration.
README 文档
README
Introduction
A PHP 8.3+ library that provides the shared MATRAUX PHP-CS-Fixer configuration.
It exposes a ready-to-use Config for project .php-cs-fixer.dist.php files and public grouped rule sets for custom PHP-CS-Fixer configurations.
Useful for keeping code style, imports, strict typing, class layout, PHPDoc cleanup, indentation, and line endings consistent across multiple PHP packages.
Features
- Ready-to-use PHP-CS-Fixer configuration via
Matraux\PhpCodeStyle\Config - Public grouped rule sets for syntax, imports, operators, functions, PHPDoc, and classes
- PER-CS baseline with automatic PHP migration rules
- Strict typing, strict comparisons, strict parameters, and function alias cleanup
- Import ordering, unused import removal, and fully qualified type normalization
- Class member ordering and class element separation
- Tabs and LF line endings configured by default
- Risky PHP-CS-Fixer rules enabled explicitly
Installation
composer require --dev matraux/php-code-style
Requirements
| version | PHP | Note |
|---|---|---|
| 1.0.0 | 8.3+ | Support PHP 8.3 |
Examples
Full configuration
Create file .php-cs-fixer.dist.php or .php-cs-fixer.php in root.
<?php declare(strict_types=1); use Matraux\PhpCodeStyle\Config; return new Config(__DIR__ . '/src');
Custom PHP-CS-Fixer configuration
<?php declare(strict_types=1); use Matraux\PhpCodeStyle\RuleSet\Sets\Imports; use Matraux\PhpCodeStyle\RuleSet\Sets\PhpDoc; use PhpCsFixer\Config; $imports = new Imports(); $phpDoc = new PhpDoc(); return (new Config()) ->registerCustomRuleSets([ $imports, $phpDoc, ]) ->setRules([ '@PER-CS' => true, $imports->getName() => true, $phpDoc->getName() => true, ]);
Run code style check
vendor/bin/php-cs-fixer check
Run code style fixer
vendor/bin/php-cs-fixer fix
Visual Studio Code
Visual Studio Code format setup is documented in Visual Studio Code.
Development
See Development for debug, static analysis, and coding standards.
Support
For bug reports and feature requests, please use the issue tracker.
matraux/php-code-style 适用场景与选型建议
matraux/php-code-style 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 05 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php-cs-fixer」 「coding-standard」 「php code style」 「MATRAUX」 「php-code-style」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 matraux/php-code-style 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 matraux/php-code-style 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 matraux/php-code-style 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
HiDev plugin for PHP-CS-Fixer
PHP Codesniffer ruleset to follow Laravel's coding style
Taptima PHP-CS-Fixer fixers
Axa Zara PHP Code style configuration for `php-cs-fixer` based on PSR-12.
The coding standard applying to all Youdot PHP projects, based on Doctrine set of PHPCS rules, with additional checks.
A generic package for implementing Laravel Pint coding standards across Laravel packages
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 54
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-11