承接 matraux/php-code-style 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

Latest Version on Packagist Last release License: MIT PHP Security Policy Contributing QA Status Issues Last Commit


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.

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 9
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固