在composer中使用wordpress和插件

时间:2019-07-10 07:57:08

标签: wordpress composer-php

总结:当某些插件已经使用composer并拥有自己的库时,如何将WordPress与Composer结合使用?

我正在使用roots / bedrock(根据需要调整了其他wordpress文件夹,并删除了一些不需要的依赖项,而我不需要),我看到的问题是,当我通过wordpress安装插件时(例如MailPoet或WP SMTP)看来这些插件都有自己的供应商文件夹和自动加载器(这意味着它们已经在使用composer了)

这是我经过调整的composer.json(与原作没有什么不同)

{
  "name": "roots/bedrock",
  "type": "project",
  "license": "MIT",
  "description": "WordPress boilerplate with modern development tools, easier configuration, and an improved folder structure",
  "homepage": "https://roots.io/bedrock/",
  "authors": [
    {
      "name": "Scott Walkinshaw",
      "email": "scott.walkinshaw@gmail.com",
      "homepage": "https://github.com/swalkinshaw"
    },
    {
      "name": "Ben Word",
      "email": "ben@benword.com",
      "homepage": "https://github.com/retlehs"
    }
  ],
  "keywords": [
    "bedrock", "composer", "roots", "wordpress", "wp", "wp-config"
  ],
  "support": {
    "issues": "https://github.com/roots/bedrock/issues",
    "forum": "https://discourse.roots.io/category/bedrock"
  },
  "config": {
    "preferred-install": "dist"
  },
  "repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org"
    }
  ],
  "require": {
    "php": ">=7.3",
    "composer/installers": "^1.4",
    "roots/wordpress": "5.2.2",
    "roots/wp-password-bcrypt": "1.0.0"
  },
  "extra": {
    "installer-paths": {
      "web/app/mu-plugins/{$name}/": ["type:wordpress-muplugin"],
      "web/app/plugins/{$name}/": ["type:wordpress-plugin"],
      "web/app/themes/{$name}/": ["type:wordpress-theme"]
    },
    "wordpress-install-dir": "web"
  }
}

没有错误消息,但是我担心冗余的发生,我完整的wordpress结构具有自动加载器和vendor /文件夹,几乎在每个插件中都发生同样的事情。我应该如何构建代码并使用它?

0 个答案:

没有答案