# Plugin installation via Composer: downloaded but not added to the plugins folder

**URL:** https://discourse.roots.io/t/plugin-installation-via-composer-downloaded-but-not-added-to-the-plugins-folder/18221
**Category:** bedrock
**Tags:** plugin, composer, deploys
**Created:** 2020-05-08T06:42:46Z
**Posts:** 8

## Post 1 by @pixeline — 2020-05-08T06:42:46Z

I’ve added a (premium) plugin via composer

```
"repositories": [
{
      "type": "composer",
      "url": "https://composer.domain.tld/packages.json?authorization=(licensekey)"
    }
]

...
"require": {
    "php": ">=7.1",
    "composer/installers": "^1",
    "vlucas/phpdotenv": "^4",
    "oscarotero/env": "^1",
    "roots/wordpress": "^5",
    "roots/wp-config": "^1",
    "roots/wp-password-bcrypt": "^1",
    "freemius/widget-for-eventbrite-api-premium": "^2.9.3"

...
```

Locally, no issue. The plugin is properly installed.  
On staging, it does not appear in the WP \> Plugins interface. It is present in the “vendor” folder though, but not present in the web/app/plugins folder.

Do you have any clue as to what is happening here and how to solve it?  
I’ve tried :

- simply redeploying
- clearing composer cache on the server (using the web user).
- `rm -rf vendor/*` then `composer install`

Thank you,  
Alex

---

## Post 2 by @Log1x — 2020-05-08T07:47:59Z

This is more than likely due to the plugin’s `composer.json` type not being set to [`wordpress-plugin`](https://github.com/roots/bedrock/blob/master/composer.json#L52-L56).

You can simply add the package name to the array along with `type:wordpress-plugin` in `installer-paths` and it should be good to go.

```
"web/app/plugins/{$name}/": ["type:wordpress-plugin", "freemius/whatever"],
```

---

## Post 3 by @pixeline — 2020-05-08T08:33:40Z

Makes sense, but I made the change to the composer.json, then composer update to refresh the .lock file, then deployed, and still, the plugin does not get copied into the `plugins` folder …

I also tried this, on the remote:  
composer remove freemius/whatever  
composer require freemius/whatever

It went smooth (no error message), but still no go.

---

## Post 4 by @alanef — 2020-05-08T13:27:47Z

Hi, the plugin author here - there is no composer.json in the plugin distribution, so can’t quite understand how that would be an issue?

---

## Post 5 by @Log1x — 2020-05-09T01:56:05Z

I’d have to see an example of the composer repo json and the plugin composer file then to really wrap my head around what is happening.

In most cases, manually defining it as a `wordpress-plugin` like my post above _should_ work regardless – so I’m not sure why it wouldn’t be.

---

## Post 6 by @pixeline — 2020-05-11T07:30:47Z

Hi!  
Thank you, I really appreciate your help. Here is my local composer.json file

```
{
  "name": "myorg/new.website.tld",
  "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"
  },
  "repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org"
    },
    {
      "type": "composer",
      "url": "https://composer.deliciousbrains.com"
    },
    {
      "type": "composer",
      "url": "https://composer.freemius.com/packages.json"
    }
  ],
  "require": {
    "php": ">=7.1",
    "composer/installers": "^1",
    "vlucas/phpdotenv": "^4",
    "oscarotero/env": "^1",
    "roots/wordpress": "^5",
    "roots/wp-config": "^1",
    "roots/wp-password-bcrypt": "^1",
    "deliciousbrains-plugin/wp-migrate-db-pro": "^1.9",
    "deliciousbrains-plugin/wp-migrate-db-pro-media-files": "^1.4",
    "deliciousbrains-plugin/wp-migrate-db-pro-cli": "^1.3",
    "deliciousbrains-plugin/wp-migrate-db-pro-theme-plugin-files": "^1.0",
    "wpackagist-plugin/ewww-image-optimizer": "^5.2",
    "wpackagist-plugin/wordfence": "^7",
    "wpackagist-plugin/autodescription": "*",
    "wpackagist-plugin/batcache": "*",
    "wpackagist-plugin/post-smtp": "^2",
    "wpackagist-plugin/password-protected": "^2",
    "roots/soil": "*",
    "wpackagist-plugin/category-posts": "^4",
    "wpackagist-plugin/enable-media-replace": "^3",
    "wpackagist-plugin/regenerate-thumbnails": "*",
    "wpackagist-plugin/safe-svg": "^1",
    "wpackagist-plugin/redis-cache": "^1",
    "wpackagist-plugin/wp-super-cache": "*",
    "soberwp/intervention": "*",
    "freemius/widget-for-eventbrite-api-premium": "^2.9"
  },
  "require-dev": {
    "squizlabs/php_codesniffer": "^3.5.4",
    "roave/security-advisories": "dev-master",
    "wpackagist-plugin/query-monitor": "*"
  },
  "config": {
    "optimize-autoloader": true,
    "preferred-install": "dist"
  },
  "minimum-stability": "dev",
  "prefer-stable": true,
  "extra": {
    "installer-paths": {
      "web/app/mu-plugins/{$name}/": [
        "type:wordpress-muplugin"
      ],
      "web/app/plugins/{$name}/": [
        "type:wordpress-plugin",
        "freemius/widget-for-eventbrite-api-premium"
      ],
      "web/app/themes/{$name}/": [
        "type:wordpress-theme"
      ]
    },
    "wordpress-install-dir": "web/wp"
  },
  "scripts": {
    "post-root-package-install": [
      "php -r \"copy('.env.example', '.env');\""
    ],
    "test": [
      "phpcs"
    ]
  }
}
```

---

## Post 7 by @strarsis — 2020-05-11T15:51:14Z

Maybe you have to use a dedicated composer installer?

> **[ffraenz/private-composer-installer](https://github.com/ffraenz/private-composer-installer)**
>
> Composer install helper outsourcing sensitive keys from the package URL into environment variables - ffraenz/private-composer-installer

---

## Post 8 by @ethanclevenger91 — 2020-05-14T17:41:12Z

If the dependency itself doesn’t have a `composer.json` that declares its type and depends on `composer/installers`, adding your own installer-path config as a consumer won’t work. [See the last note on this page.](https://getcomposer.org/doc/faqs/how-do-i-install-a-package-to-a-custom-path-for-my-framework.md)

So the plugin author must add a `composer.json` that declares the plugin as type `wordpress-plugin` for this to work. Not sure how you’re making it work in your local environment…
