mingsong-hu/drupalsecurity
Composer 安装命令:
composer require mingsong-hu/drupalsecurity
包简介
Drupal Security is a library to review security issue of Drupal code.
README 文档
README
DrupalSecurity is a library for automated Drupal code security reviews. It defines rules for PHP_CodeSniffer
Note that Javascript has not been supported yet. To check and fix Javascript files please use ESLint and see the Drupal ESLint documentation.
Global installation
composer global require "squizlabs/php_codesniffer=*"
composer global require mingsong-hu/drupalsecurity
Make sure you have the composer bin dir in your PATH. The default value is ~/.composer/vendor/bin/, but you can check the value that you need to use by running
composer global config bin-dir --absolute
Usage
Check Drupal Security standards
phpcs --standard=DrupalSecurity --ignore='*/tests/*' --extensions=php,module,inc,install,theme,yml,twig [/file/to/drupal/module]
List all sniffers
phpcs --standard=DrupalSecurity -e
Excluding files from credential scanning
The HardcodedCredentials sniff detects hardcoded passwords, API keys, tokens,
and secrets in PHP and YAML files. Autogenerated or third-party config files may
produce false positives. There are three ways to suppress them.
1. Exclude paths in phpcs.xml (recommended for directories or filename patterns)
Create a phpcs.xml in your project root:
<?xml version="1.0"?> <ruleset> <rule ref="DrupalSecurity"/> <!-- Exclude all Key module config files. --> <exclude-pattern>config/sync/key.key.*.yml</exclude-pattern> <!-- Exclude a specific autogenerated file. --> <exclude-pattern>config/sync/easy_encryption.keys.yml</exclude-pattern> </ruleset>
2. # phpcs:ignoreFile in the YAML file (for a single autogenerated file)
Add this comment anywhere in the file — the top is conventional:
# phpcs:ignoreFile -- autogenerated, do not edit manually. password: 'some-value-that-would-otherwise-be-flagged'
3. # phpcs:ignore on a single line (for individual false positives in YAML)
key_value: 'some-value' # phpcs:ignore DrupalSecurity.Credentials.HardcodedCredentials.HardcodedCredential
For PHP files, the standard PHPCS inline suppression works without any special handling:
$password = 'some-value'; // phpcs:ignore DrupalSecurity.Credentials.HardcodedCredentials.HardcodedCredential
mingsong-hu/drupalsecurity 适用场景与选型建议
mingsong-hu/drupalsecurity 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 2, 最近一次更新时间为 2026 年 02 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「security」 「drupal」 「standards」 「phpcs」 「code review」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mingsong-hu/drupalsecurity 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mingsong-hu/drupalsecurity 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mingsong-hu/drupalsecurity 相关的其它包
同方向 / 同关键字的高下载量 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.
Provides an add-on purchasable entity.
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.
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 32
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0
- 更新时间: 2026-02-18