brick/coding-standard
最新稳定版本:v4
Composer 安装命令:
composer require brick/coding-standard
包简介
Coding standard tools and configurations used in Brick organization.
README 文档
README
Coding standard for Brick libraries.
Overview
This coding standard is used in Brick libraries, but can also be used in your own projects.
It is based on PSR-12 and uses Easy Coding Standard with rules cherry-picked from PHP-CS-Fixer, PHP_CodeSniffer, and the Slevomat coding standard.
Release process
This project is released with sequential version numbers: v1, v2, etc.
Each new version should be considered as breaking, as it may update dependency versions, add new rules, or modify existing ones.
Usage
Use locally
To use brick/coding-standard locally, install it with Composer:
composer require --dev brick/coding-standard
Then create an ecs.php file in the root of your project with the following content:
<?php declare(strict_types=1); use Symplify\EasyCodingStandard\Config\ECSConfig; return static function (ECSConfig $ecsConfig): void { $ecsConfig->import(__DIR__ . '/vendor/brick/coding-standard/ecs.php'); $ecsConfig->paths( [ __DIR__ . '/src', __DIR__ . '/tests', __FILE__, ], ); };
You can then run Easy Coding Standard with:
vendor/bin/ecs
or, to fix coding standard violations automatically:
vendor/bin/ecs --fix
If you wish to avoid conflicts with your project dependencies, you may also install ECS in a tools directory with its
own composer.json instead. Here is how your directory may look like:
tools/
└── ecs/
├── composer.json
├── composer.lock
└── ecs.php
└── vendor/
└── ...
Use in GitHub Actions
You can integrate brick/coding-standard in your GitHub Actions workflow as follows:
name: Coding Standard on: pull_request: push: jobs: coding-standard: name: Coding Standard uses: brick/coding-standard/.github/workflows/coding-standard.yml@v1
By default, this workflow will run on PHP 8.2. You can change the PHP version by adding:
with: php-version: 8.5
Only versions >= 8.2 are supported.
Other options available are:
composer-optionsworking-directoryconfig-file
统计信息
- 总下载量: 261
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-29
