爬虫 / 编码规范
1.1.2
2023-09-01 18:06 UTC
Requires
- php: ^8.2
- phpcompatibility/php-compatibility: ^9.3
- sirbrillig/phpcs-variable-analysis: ^2.11
- slevomat/coding-standard: ^8.13
- squizlabs/php_codesniffer: ^3.7
Requires (Dev)
- enlightn/security-checker: ^1.10
- ergebnis/composer-normalize: ^2.35
README
此软件包提供了爬虫编码规范的规则集。它需要 squizlabs/php_codesniffer 以及一些扩展(见 composer.json)。
安装
您可以通过 composer 安装此软件包(您只需在开发时使用它即可)
composer require crawl/coding-standard --dev
用法
根据您的项目,将 phpcs-laravel.xml 或 phpcs-package.xml 从 config/ 复制到您的项目中。
注意:使用
phpcs-package.xml时,不要忘记更新Package\Namespace。
然后您可以运行 PHP Code Sniffer/Beautifier
$ vendor/bin/phpcs --standard=./path/to/copied/phpcs.xml
$ vendor/bin/phpcbf --standard=./path/to/copied/phpcs.xml
为了更方便的使用,将以下内容添加到项目 composer.json 中的 scripts
...
"scripts": {
...
"style": "vendor/bin/phpcs --standard=./path/to/copied/phpcs.xml",
"fix-style": "vendor/bin/phpcbf --standard=./path/to/copied/phpcs.xml",
}.
...
然后您可以使用 composer style 来运行 sniffer,以及使用 composer fix-style 来运行 beautifier。
变更日志
有关最近更改的更多信息,请参阅 CHANGELOG
贡献
有关详细信息,请参阅 CONTRIBUTING
安全
如果您发现任何安全相关的问题,请发送电子邮件至 security@gkcld.net,而不是使用问题跟踪器。
作者
许可证
MIT 许可证 (MIT)。有关更多信息,请参阅 LICENSE