Search

Table of Contents

Install PublishPress Plugins using Composer

You are here:

It is possible to install and manage the PublishPress plugins using Composer.

There are separate instructions for the Free and Pro plugins.


For the PublishPress Free plugins

Settings for composer.json

Here is an example of the composer.json file based on WPStarter:

{
  "name": "gmazzap/wpstarter-simple-example",
  "description": "Example project for WordPress + Composer + WP Starter",
  "type": "project",
  "repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org"
    }
  ],
  "require": {
    "wecodemore/wpstarter": "~2.0",
    "wpackagist-plugin/publishpress": "*"
  },
  "config": {
    "vendor-dir": "wp-content/vendor"
  },
  "scripts": {
    "post-install-cmd": "WCM\\WPStarter\\Setup::run",
    "post-update-cmd": "WCM\\WPStarter\\Setup::run"
  },
  "extra": {
    "wordpress-install-dir": "wp"
  }
}

WPStarter is not required, but it is one way you can use to install WordPress itself as a Composer dependency. If you don't use WPStarter, you can add the following properties to your own composer.json file:

{
  "repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org"
    }
  ],
  "require": {
    "wpackagist-plugin/publishpress": "*"
  }
}

In the repository property, don't use our Github repository URL, but use the WPackagist repository.


For the PublishPress Pro plugins

The Pro plugins are available on our private repositories. In order to get access you need some additional configurations.

Settings for composer.json

Here is an example for the composer.json file based on WPStarter:

{
  "name": "gmazzap/wpstarter-simple-example",
  "description": "Example project for WordPress + Composer + WP Starter",
  "type": "project",
  "repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org"
    },
    {
        "type": "vcs",
        "url": "https://github.com/publishpress/PublishPress.git"
    },
    {
      "type": "vcs",
      "url": "https://github.com/publishpress/PublishPress-Pro.git"
    }
  ],
  "require": {
    "wecodemore/wpstarter": "~2.0",
    "publishpress/publishpress-pro": "*"
  },
  "config": {
    "vendor-dir": "wp-content/vendor"
  },
  "scripts": {
    "post-install-cmd": "WCM\\WPStarter\\Setup::run",
    "post-update-cmd": "WCM\\WPStarter\\Setup::run"
  },
  "extra": {
    "wordpress-install-dir": "wp"
  }
}

If you don't use WPStarter, here are the required properties you should add to your own composer.json file:

{
  "repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/publishpress/PublishPress.git"
    },
    {
      "type": "vcs",
      "url": "https://github.com/publishpress/PublishPress-Pro.git"
    }
  ],
  "require": {
    "publishpress/publishpress-pro": "*"
  }
}

In the repository property, don't use our Github repository's URL, but use the WPackagist repository.

Settings for wp-config.php

The Pro plugin requires an additional configuration in the wp-config.php file. You need to define two constants for specifying the path and URL of your vendor directory. The plugin requires the vendor directory is available to the internet.

define('PUBLISHPRESS_CUSTOM_VENDOR_URL', 'https://dev.local/wp-content/vendor/');
define('PUBLISHPRESS_CUSTOM_VENDOR_PATH', '/Users/me/Local Sites/dev/app/public/wp-content/vendor/');

Access to our private repositories

If you have an active PublishPress subscription, please email us sending us your public SSH key and ask for repository access.

The authentication is done using SSH keys. You will need to generate and send one key per repository you want to access.

In case you need more info about how to generate SSH keys you can read this documentation: Generating a new SSH key and adding it to the ssh-agent.

Those keys need to be generated, or installed, in the server you want to install our plugins using Composer.

Professional publishing plugins for WordPress! Get PublishPress