bueltge / must-use-loader

This small WordPress plugin include all plugins in subdirectories from Must Use plugin folder
MIT License
62 stars 21 forks source link

[Feature Request] Autoload via Composer #12

Closed vinkla closed 5 years ago

vinkla commented 6 years ago

This plugin looks great and it has a lot of potential! Have you considered adding support for autoloading the plugin via Composer? Then we could skip the step to active the plugin via the WordPress dashboard.

bueltge commented 6 years ago

Hi @vinkla Thanks. Have you read the hint inside the readme? You can install the mu plugin via Composer, it is available via packagist. Maybe I'm understand your question not correctly, please extend it. Best.

vinkla commented 6 years ago

I know it is installable via Composer. Let me try to explain it in more detail. Right now, when you install the package via Composer it is installed as a WordPress plugin with the wordpress-plugin type. Instead it would be cool if it wasn't a WordPress plugin at all. It could "just" be a Composer package and the package would autoload mu-plugins automatically without having to activate the must-use-loader plugin.

bueltge commented 6 years ago

However if you use composer installer, there have been the option wordpress-muplugin, instead of wordpress-plugin, install in the mu-plugin directory. See the readme from https://github.com/composer/installers

But my plugin have inside his composer.json declare the type of the repository - see https://github.com/bueltge/must-use-loader/blob/master/composer.json#L11 So if you set the repo as require that will install as mu-plugin, if you use composer/installers also inside your composer.json file.

I mean like this:

{
  "name": "bueltge/must-use-loader",
  "type": "wordpress-muplugin",
  "require": {
    "composer/installers": "v1.0.6"
  }
}

What you think? I have currently not a working install or time for check this. As small hint, this post should help and here is an full working example of a composer.json.

vinkla commented 6 years ago

Maybe, not sure how it could be implemented. It could work.

bueltge commented 6 years ago

Great, I will wait for your feedback.

cfoellmann commented 6 years ago

can we reopen this?

I have a problem with the composer install routine. When I use the must-use-loader as a common wordpress-muplugin it will be installed in wp-content/mu-plugins/must-use-loader/ which does not work. the must-use-loader.php file must end up in wp-content/mu-plugins/

vinkla commented 6 years ago

@cfoellmann I suggest you take a look at WordPlate. It comes with must-use plugin autoloader built-in.

bueltge commented 6 years ago

We should reopen it if it not work.

cfoellmann commented 6 years ago

thanks @vinkla . Will have a look at your project. But I want to sort this out for the must-use-loader otherwise composer support as wordpress-muplugin is pointless

vinkla commented 5 years ago

Cleaning up my issues and closing this.