pragmaticweb/php-coding-standards
Composer 安装命令:
composer require pragmaticweb/php-coding-standards
包简介
Style guide for writing consistent PHP code for WordPress projects.
README 文档
README
A project by Pragmatic.
Style guide for writing consistent PHP code for WordPress projects.
Installation
Our PHP coding standards are enforced via php_codesniffer and can be installed using the PHP package manager composer.
$ composer require pragmaticweb/php-coding-standards --dev
Usage
Basic usage
When installed using composer, our coding standards are ready to be used by running:
$ vendor/bin/phpcs --standard="Pragmatic" ./my-plugin ./my-file.php
Configuration file
In order to make it easier to modify our standards to better fit your project, you can create a phpcs.xml.dist file which could contain something like this:
<?xml version="1.0"?> <ruleset name="MyProjectCodingStandard"> <description>My Project coding standard.</description> <file>./my-plugin</file> <file>./my-file.php</file> <config name="text_domain" value="my-project"/> <rule ref="Pragmatic" /> </ruleset>
Using a config file, allows you to only run vendor/bin/phpcs to check the code style.
For more advanced usage, please refer to the PHP Codesniffer docs.
Included rules
WordPress Coding Standard
We're pretty much using WordPress coding standards at this point with some exclusions (see ruleset.xml).
See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.
PHPcompatibilityWP
It allows to analyse code for compatibility with higher and lower versions of PHP. The default target version is PHP 7.0+.
Target version can be changed via custom phpcs.xml.
See https://github.com/PHPCompatibility/PHPCompatibilityWP
PSR2
See https://github.com/php-fig-rectified/psr2r-sniffer
Contributing
The Pragmatic coding standards is what enables our engineers to work together and write consistent PHP code.
Pull requests are welcome but will need to be reviewed by the members of our team.
Please open an issue first to discuss what you would like to change and, if our team agrees with it, then we could look into merging them.
pragmaticweb/php-coding-standards 适用场景与选型建议
pragmaticweb/php-coding-standards 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 575 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 04 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 pragmaticweb/php-coding-standards 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pragmaticweb/php-coding-standards 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 575
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2020-04-08