Best way to have paid plugin dependencies? Particularly Visual Composer?

Hi all,

For all my plugins used so far on a new project I’m setting up wpackagist dependencies in composer.json which makes it super easy to manage. But I also need to use WPBakery page builder (formerly Visual Composer) - this is an Envato ‘paid’ plugin, so what would be the best way to set up this kind of dependency??

Many thanks
Kevin

1 Like

I recommend SatisPress, though you could also investigate Satis.

1 Like

There are a lot of other threads on this subject. Be sure to search for existing solutions before posting a new thread.

I’m assuming you’re talking about Bedrock here, even though this thread is tagged Sage; everything below presumes you’re using Bedrock.

SatisPress is a great option, but requires a little more management than I usually need. Here’s how I handle it:

Create a private GitHub Repo for your paid plugin

I’m using SearchWP as an example here.

Create a composer.json and commit it to the repository alongside the plugin code:

{
  "name": "mwdelaney/searchwp",
  "description": "",
  "keywords": ["wordpress", "plugin", "search"],
  "homepage": "https://github.com/mwdelaney/searchwp",
  "license": "MIT",
  "authors": [
    {
      "name": "Michael W. Delaney",
      "email": "name@domain.com",
      "homepage": ""
    }
  ],
  "type": "wordpress-plugin",
  "require": {
    "php": ">=5.3.2"
  }
}

Make sure the repository private, otherwise you’re making paid code available to the world! Commit your paid plugin (and the above composer.json file) to the repo and create a release matching the version number of the plugin you’re committing.

Add the private repo to your project’s composer.json

Add the repository to the repositories section of composer.json

	"repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org"
    },
    ...
    {
      "type": "vcs",
      "url": "git@github.com:mwdelaney/searchwp.git"
    },
    ...
  ],
 

And add the actual plugin to the require section of composer.json

  "require": {
    ...
    "mwdelaney/searchwp": "^2.9.5",
    ...
  },

Update your dependencies

Run composer update in your bedrock directory to get your new plugin.

5 Likes

Thanks folks, @MWDelaney appreciate the very thorough information, apologies for not searching as well as I could have done - hopefully this will serve as a useful resource to others!

Kevin

1 Like

Using Satispress, we need to have a live server as your composer repository, as opposed to

http://example.test/satispress

Right?

Yes, exactly. And because of the way it works, that instance can’t use Bedrock.

1 Like

So it’s kind of like using Wordpress as a wrapper for Satis. And Am I understanding correctly that Satis is kind of like a DIY packagist.com?

1 Like

Private Packagist maybe?

1 Like

@danielroe OK, so based on your comment about not being able to use Bedrock I take it that you can’t manage the premium plugins via the site repository, you actually have to have the WordPress plugin update process run to create the packages for the Composer repository?

You could use Bedrock but in that case you would have to allow the WordPress native updater and opt out of composer management of those plugins.

But once you have Satispress ruining, on all your other sites you can manage your premium plugins with composer.