youwe/coding-standard
Composer 安装命令:
composer require youwe/coding-standard
包简介
Youwe PHP Coding Standard
README 文档
README
This is the Youwe coding standard, it contains rule sets for PHPCS and PHPMD.
Installation
Use composer to install the coding standard in the home directory.
composer global require youwe/coding-standard
Configuring PHPStorm to use the coding standard.
First configure PHPStorm to use the right phpcs command.
Go to Settings > Languages & Frameworks > PHP > Code Sniffer. Choose
"Local" for the path and fill in the full path to
~/.config/composer/vendor/bin/phpcs
Then go to Settings > Editor > Inspections and search for PHP Code Sniffer
Validation. Select Custom and the add the path to
~/.config/composer/vendor/youwe/coding-standard/src/Youwe
Using the coding standard in a project
To use the standard in a project the standard needs to be required in composer.
cd <project_directory> composer require youwe/coding-standard --dev
This will add the coding standard to the vendor directory of the project.
To let phpcs use the coding standard add a file phpcs.xml to the root of the project.
<?xml version="1.0"?> <ruleset> <rule ref="./vendor/youwe/coding-standard/src/Youwe"/> </ruleset>
The standard can be checked from the command line by going to the directory.
cd <project_directory> ./vendor/bin/phpcs ./src
Configuring PHP CodeSniffer to also show less severe messages
By default PHP CodeSniffer shows only messages with a severity higher than 5. The Youwe coding standard also has some messages with a lower severity. These are messages that encourage a better way of coding but should not block a pull request.
To configure phpcs to show also these messages execute the following command.
~/.config/composer/vendor/bin/phpcs --config-set severity 1
youwe/coding-standard 适用场景与选型建议
youwe/coding-standard 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 195.08k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2022 年 02 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 youwe/coding-standard 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 youwe/coding-standard 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 195.08k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 10
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-02-18