wealcoder/wealcoder-coding-standard
Composer 安装命令:
composer require wealcoder/wealcoder-coding-standard
包简介
A Wealcoder PHP_CodeSniffer standard that extends the official WordPress Coding Standards—customized for modern, secure, and consistent PHP development across all Wealcoder projects. Designed to enforce best practices and maintain high code quality in line with Wealcoder's engineering guidelines.
关键字:
README 文档
README
A Wealcoder PHP_CodeSniffer standard that extends the official WordPress Coding Standards—customized for modern, secure, and consistent PHP development across all Wealcoder projects. Designed to enforce best practices and maintain high code quality in line with Wealcoder's engineering guidelines.
Installation
Install via Composer:
composer require Wealcoder/wealcoder-coding-standard
For Global
composer global require Wealcoder/wealcoder-coding-standard
The package will automatically:
- Install PHP_CodeSniffer and required dependencies
- Register the
Wealcoder-Coding-Standardstandard - Set it as the default standard for your project
Usage
Command Line
Quick Check
vendor/bin/phpcs .
Using Composer Script
composer run phpcs
Custom Configuration
vendor/bin/phpcs --standard=Wealcoder-Coding-Standard path/to/files
IDE Integration
For better IDE integration, create a .phpcs.xml.dist file in your project root:
<?xml version="1.0"?> <ruleset name="Project Standards"> <description>A customized PHP_CodeSniffer ruleset that extends the official WordPress Coding Standards, tailored for modern, secure, and consistent PHP development practices.</description> <!-- Scan these directories --> <file>src/</file> <file>inc/</file> <!-- Exclude these paths --> <exclude-pattern>vendor/</exclude-pattern> <exclude-pattern>node_modules/</exclude-pattern> <exclude-pattern>*.min.js</exclude-pattern> <!-- Configuration --> <config name="minimum_supported_wp_version" value="6.2" /> <config name="testVersion" value="7.4-8.5" /> <!-- Use WordPress Code standards --> <rule ref="Wealcoder-Coding-Standard" /> <!-- Project-specific customizations --> <rule ref="WordPress.WP.I18n"> <properties> <property name="text_domain" type="array"> <element value="replace-with-your-current-text-domain"/> </property> </properties> </rule> </ruleset>
Continuous Integration
Add to your CI workflow:
# GitHub Actions example - name: PHP CodeSniffer run: composer run phpcs
Configuration Details
PHP Version Support
- Minimum: PHP 7.4
- Maximum: PHP 8.4
- Compatibility: Uses PHPCompatibilityWP for WordPress-specific compatibility checks
Key Rules Applied
- WordPress Coding Standards (with sensible exclusions)
- Tab indentation (1 tab per indent level)
- Space inside parentheses for readability
- Superfluous whitespace detection
- PHP compatibility checking for WordPress
Excluded Rules
The following rules are excluded for practical development:
- File naming conventions (WordPress.Files.FileName)
- Nonce verification requirements
- Direct database query restrictions
- Global variable override prohibitions
- Some documentation capitalization requirements
Customization
Project-Level Overrides
Create a phpcs.xml.dist file to override or add rules:
<rule ref="Wealcoder-Coding-Standard"> <!-- Enable a rule that's disabled by default --> <exclude name="WordPress.Files.FileName" /> </rule> <!-- Add custom exclusions --> <rule ref="WordPress.Security.NonceVerification.Missing"> <exclude-pattern>admin/ajax-handlers/*</exclude-pattern> </rule>
Inline Annotations
Disable rules for specific code blocks:
// phpcs:disable WordPress.Security.NonceVerification.Missing if ( isset( $_POST['data'] ) ) { // Process data without nonce check } // phpcs:enable WordPress.Security.NonceVerification.Missing
Requirements
- PHP 7.4 or higher ( Upto 8.4 )
- Composer
- PHP_CodeSniffer 3.9.0 or higher
Dependencies
dealerdirect/phpcodesniffer-composer-installer: ^1.0phpcompatibility/phpcompatibility-wp: ^2.1wp-coding-standards/wpcs: ^3.1.0
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test with
composer run phpcs - Submit a pull request
License
GPL-3.0-or-later
Author
Wealcoder
Email: habib41juwel@gmail.com
Organization: Wealcoder
wealcoder/wealcoder-coding-standard 适用场景与选型建议
wealcoder/wealcoder-coding-standard 是一款 基于 Shell 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 11 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「wordpress」 「standards」 「phpcs」 「code standard」 「Wealcoder」 「wealcoder coding standard」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 wealcoder/wealcoder-coding-standard 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wealcoder/wealcoder-coding-standard 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 wealcoder/wealcoder-coding-standard 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP_CodeSniffer custom Sniff for Laravel coding standard
A set of abstractions that define core services provided by the DVSA
This is the ZooRoyal coding standard.
Vanio Coding Standard Ruleset for PHP_CodeSniffer.
The coding standard applying to all Youdot PHP projects, based on Doctrine set of PHPCS rules, with additional checks.
CodeSniffer ruleset for the ZettaCMS coding standard
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2025-11-18