subscribepro/subscribepro-magento2-ext

Subscribe Pro Magento 2 集成扩展

1.7.3 2024-09-20 14:06 UTC

README

Latest Stable Version Total Downloads Latest Unstable Version License

这是 Subscribe Pro 的官方 Magento 2 扩展。

要了解更多关于 Subscribe Pro 的信息,您可以访问我们的网站 https://www.subscribepro.com/

入门指南

请访问我们的文档网站,并从我们的 Magento 2 步骤指南开始: https://docs.subscribepro.com/display/spd/Install+Subscribe+Pro+for+Magento+2

通过 Composer 安装

您可以通过 Composer 安装我们的 Subscribe Pro Magento 2 扩展。请在您的 Magento 安装根目录下运行以下命令

composer require subscribepro/subscribepro-magento2-ext
php bin/magento module:enable Swarming_SubscribePro
php bin/magento setup:upgrade

编码标准

Subscribe Pro 团队遵循 https://devdocs.magento.com 中描述的标准

Subscribe Pro 的内部编码标准

  • 在 PHPDoc 中使用完全限定的类名,例如
    /**
     * @param \Magento\Framework\App\RequestInterface $request
     * @return bool
     */
    
    这可以在浏览代码时使代码更清晰,在处理具有相似名称但属于不同命名空间类的代码时,留下的歧义更少。在 IDE 中,如果使用别名,则不需要双击 Ctrl+click 实际查看类。这也消除了仅为了编写 phpdoc/comment 而包含不必要的 use 操作符的情况。
  • 类型转换后不留空格,例如
    (int)$variable
    
    在编写本文档时,现有的 PHP 标准没有规定这一点,因此选择“不留空格”。

要确认项目符合 PHP_CodeSniffer 标准化

运行 PHP_CodeSniffer

vendor/bin/phpcs -s \
  --standard=Magento2 app/code/Swarming/SubscribePro \
  --extensions=phtml \
  --error-severity=10 \
  --ignore-annotations \
  --exclude=Magento2.Annotation.MethodAnnotationStructure \
  app/code/Swarming/SubscribePro

通过 PHP Code Beautifier 和 Fixer 自动修复某些问题

bin/phpcbf --standard=Magento2 \
  --extensions=phtml \
  --error-severity=10 \
  --ignore-annotations \
  --exclude=Magento2.Annotation.MethodAnnotationStructure \
  app/code/Swarming/SubscribePro

运行 phpstan

bin/analyse app/code/Swarming/SubscribePro --level=1 -c app/code/Swarming/SubscribePro/phpstan.neon

运行 PHP Coding Standards Fixer (php-cs-fixer)

php-cs-fixer fix src/app/code/Swarming/SubscribePro