Using private Wordpress repositories with Composer

Information on installing some premium WP plugins via composer is not always very easy to find. I will try to gather everything I find into this article.

WP Migrate DB Pro

{
  "repositories": [
    {
      "type": "package",
      "package": {
        "name": "deliciousbrains/wp-migrate-db-pro",
        "version": "1.4.1", // Latest at the time of writing
        "type": "wordpress-plugin",
        "dist": {
          "type": "zip",
          "url": "https://deliciousbrains.com/?wc-api=delicious-brains&request=download&licence_key=[YOUR_LICENSE]&site_url=[YOUR_SITE_URL]"
        },
        "require" : {
          "composer/installers": "v1.0.7"
        }
      }
    },
    {
      "type": "package",
      "package": {
        "name": "deliciousbrains/wp-migrate-db-pro-media-files",
        "version": "1.1.4",  // Latest at the time of writing
        "type": "wordpress-plugin",
        "dist": {
          "type": "zip",
          "url": "https://deliciousbrains.com/?wc-api=delicious-brains&request=download&licence_key=[YOUR_LICENSE]&slug=wp-migrate-db-pro-media-files&site_url=[YOUR_SITE_URL]"
        },
        "require" : {
          "composer/installers": "v1.0.7"
        }
      }
    }
  ],
  "require": {
    "deliciousbrains/wp-migrate-db-pro": "*",
    "deliciousbrains/wp-migrate-db-pro-media-files": "*",
  }
}

Setting up your own private repository

Nothing difficult here. Create a folder on your server, protected by http basic auth. Zip the plugin and drop it into the protected folder. Add a composer.json file inside the zip, something like this:

{
  "name": "advancedcustomfields/repeater-field",
  "description": "Break free from static inputs and create multiple rows of loop-able data",
  "keywords": ["wordpress", "plugin", "advancedcustomfields", "acf", "repeater"],
  "homepage": "http://www.advancedcustomfields.com",
  "license": "This software is NOT to be distributed, but can be INCLUDED in WP themes: Premium or Contracted.",
  "authors": [
    {
      "name": "Elliot Condon",
      "email": "[email protected]",
      "homepage": "http://www.elliotcondon.com"
    }
  ],
  "type": "wordpress-plugin",
  "require": {
    "composer/installers": "v1.0.7"
  }
}

Now, into your site’s composer.json, add the following:

{
     "type": "package",
     "package": {
         "name": "advancedcustomfields/repeater-field",
         "type": "wordpress-plugin",
         "version": "3.1.7",
         "dist": {
             "url": "http://[YOUR_USERNAME]:[YOUR_PASSWORD]@codelight.eu/private/wordpress/plugins/acf-repeater.zip",
             "type": "zip"
         }
     }
 }

And that’s all.

(Note that the ACF repeater example is no longer relevant, as Elliott has released ACF Pro which includes all the add-ons.)

Indrek K├Ánnussaar

I'm a veteran Wordpress developer, context-driven tester, security enthusiast and the mastermind behind Codelight. I love building stuff that works and fixing stuff that doesn't.

Write me directly [email protected]

One Response to “Using private WordPress repositories with Composer”

  1. Nino Treyssat-Vincent

    I know this an old article, but if you want to use the `Setting up your own private repository` trick, be aware that `username:[email protected]` is deprecated.

    You should use the http-basic option from composer :
    https://getcomposer.org/doc/06-config.md#http-basic

    Reply

Leave a Reply

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×