爬虫/编码规范

爬虫编码规范

1.1.2 2023-09-01 18:06 UTC

This package is auto-updated.

Last update: 2024-09-30 02:13:07 UTC


README

Latest Version on Packagist Total Downloads

此软件包提供了爬虫编码规范的规则集。它需要 squizlabs/php_codesniffer 以及一些扩展(见 composer.json)。

安装

您可以通过 composer 安装此软件包(您只需在开发时使用它即可)

composer require crawl/coding-standard --dev

用法

根据您的项目,将 phpcs-laravel.xmlphpcs-package.xmlconfig/ 复制到您的项目中。

注意:使用 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