How to Install Public Plugins via Composer

Trying to find the recommend method for installing plugins via trellis, bedrock and sage.

Typically, would drag and drop a plugin into the /site/web/app/plugins/ and then enable via WP Admin. Dropped Soil plugin into that folder and the did vagrant ssh and wp plugin soil. While that’s better, I’d now like to use the proper method via composer.

Trying to find a walkthrough of every step to install a public plugin, such as jetpack.

Did vagrant ssh, then tried “composer require automattic/jetpack” which didn’t give any errors but didn’t see the plugin when logging into WordPress. Also tried opening composer.json locally and in “require”: {" I added, "“automattic/jetpack”: “3.8.1"” but then don’t see the plugin being added.

I know I’m close but trying to find the high level work flow. Such as if I should be doing composer json, then vagrant ssh enable plugin, or via composer require “plugin name” etc.


1 Like

I’m just getting into this bit of it myself, but have you seen this -

… and instructions for custom install paths -

Hi there.

Yes, when I tried adding “automattic/jetpack”: “3.8.1” to my composer.json I had got that line from the But haven’t had luck in getting it working as still not sure on the exact process. Such as that site mentions to run “$ composer.phar update” but not sure if I should be doing that locally or first doing vagrant ssh, as well as which directory I should be doing it in for trellis/bedrock/sage.

Been trying different variations such as doing it locally and via vagrant ssh, as well as trying to run grunt after, as well as grunt watch, but I not sure if that’s necessary as it may only require composer.phar.

I’m going to keep searching though to see if I can find anyone who has written out each step for installing a standard public plugin with roots. Thanks!

composer require automattic/jetpack is correct and should work. What’s the output of that command? Does the plugin appear in web/app/plugins?

When running that after doing vagrant ssh it says,

Using version ^3.8 for automattic/jetpack
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files

But it doesn’t get installed in in site/web/app/plugins/

*Update - When in vagrant ssh I cd to “wp-content/plugins” and see jetpack there, but the plugin isn’t showing up locally in the “site/web/app/plugins/”. Another commenter previously had mentioned I should be running composer commands in vagrant ssh but should i be running that locally instead perhaps or a reason why the vagrant ssh plugin directory isn’t synced with the local site?

Can you post your composer.json file?

Sure. It’s the default composer.json that got created as part of installing trellis,bedrock,sage with the exception of adding that one line noted above about jetpack:

  "name": "roots/bedrock",
  "type": "project",
  "license": "MIT",
  "description": "A modern WordPress stack",
  "homepage": "",
  "authors": [
      "name": "Scott Walkinshaw",
      "email": "",
      "homepage": ""
      "name": "Ben Word",
      "email": "",
      "homepage": ""
  "keywords": [
    "bedrock", "roots", "wordpress", "stack", "composer", "vagrant", "wp"
  "support": {
    "issues": "",
    "forum": ""
  "config": {
    "preferred-install": "dist"
  "repositories": [
      "type": "composer",
      "url": ""
  "require": {
    "php": ">=5.5",
    "composer/installers": "~1.0.12",
    "vlucas/phpdotenv": "^2.0.1",
    "johnpbloch/wordpress": "4.4",
    "wpackagist-plugin/jetpack": "3.8.2"
  "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/wp"

You have "wpackagist-plugin/jetpack": "3.8.2" in there which might be causing problems since you’re running composer require automattic/jetpack.

Do this:

  1. vagrant ssh
  2. cd current dir
  3. remove "wpackagist-plugin/jetpack": "3.8.2" from composer.json
  4. rm -rf web/app/plugins and vendor/ (assuming you have no non-Composer plugins in there)
  5. rm composer.lock
  6. composer install
  7. composer require automattic/jetpack

I just ran that command on a fresh Trellis/Bedrock install and it correctly install Jetpack into web/app/plugins

Went ahead and tried that but no luck.

To note, the composer.json provided is the one from my local site. /site/composer.json

In vagrant, the composer.json just had:

    "require": {
        "automattic/jetpack": "^3.8"

That file is in /trellis/composer.json

Should those files automatically sync, or should I delete the composer.json in /site/ and copy and paste the contents that was in it into /trellis/composer.json? Or perhaps delete both and start fresh with composer?

I’m thinking that may be the issue, that I installed composer on the site directory rather than in trellis directory initially?

Looks like you’re using the roots-example-project structure?

The site/ subdirectory will be automatically synced to /srv/www/<site_name>/current via Vagrant. It uses the local_path variable:

There should be no composer.json file in trellis/.

That means you ran the composer commands in the Trellis folder. You need to run it where the Bedrock installation is, and where the composer.json file is

1 Like

You rock! Thank you all for the team work, very helpful.

As Kalen noted, my issue was I mistakenly also installed composer in trellis (rather than just using it in the sites folder. Actually, I should have realized that when Swalkinshaw mentioned to cd current dir.

Went ahead and deleted the composer and vendor assets from the incorrect locations and then also removed them from the current directory and started fresh installing them there again based on swalkinshaw’s previous instructions and everything is now working as expected. Yay!

Thanks again for discovering my roots newbie misstep.