Install Soil in Sage Vendor Directory with Composer, non-Bedrock

Is it possible to to install Soil as a vendor library, similar to soberwp/intervention, using Composer?

Yes it seems you would be able to do so

Check out this link

Yeah, there’s a composer install, but it creates a /wp-content/plugins/soil directory when using a non-bedrock install. I’d like to load it into /wp-content/themes/sage/vendor instead.

I’d like the plugin to be loaded as a library instead of a plugin, and to be hidden, similar to soberwp/intervention and johnbillion/extended-cpts does.

Soil is a WP plugin though, the packages you mention are not.

Soil could be extracted to work as a Composer package, but as it stands, it’s a WordPress plugin and expected to be installed as such. If you don’t want users to be able to see it, install it as a must use plugin (mu-plugin).

Ah, I see… and I should be able to install into the mu-plugins folder by using custom installer-path, right?

Soil would be great as a developer library, don’t you think? Is there any particular reason why it’s a plugin instead?

Soil’s time came before Sage’s dependency on composer’s autoload.

Nonetheless, yeah, installer-path works and is how I handle Soil and a number of other plugins that I want treated as an mu-plugin.

Considering you’re not using Bedrock, I’m assuming the only place Composer is being utilized is Sage it’s self, so I’d suspect you’d want something like:

  "extra": {
    "installer-paths": {
      "../../mu-plugins/{$name}/": [
      "../../plugins/{$name}/": ["type:wordpress-plugin"]

Thanks Log1x, that works great!

From what I understand, since the plugin is in a sub-folder, it also requires an autoloader.php in the mu-plugins directory? Is there any way to avoid/bypass the autoload and not have it show up in the admin panel?

Ah, I found this:

add_filter( 'show_advanced_plugins', '__return_false' );

Added that to my autoload.php and looks like it’s working.

…and I also found that you can require the plugin from the functions file and it will stop it from showing up in the mu-plugin section.

require WPMU_PLUGIN_DIR.'/soil/soil.php';