WPBP / WordPress-Plugin-Boilerplate-Powered

Wordpress Plugin Boilerplate but Powered with examples and a generator!
https://wpbp.github.io/
GNU General Public License v3.0
782 stars 116 forks source link

How to install as a dependency #196

Closed LucasDemea closed 2 years ago

LucasDemea commented 2 years ago

Hi, I'm trying to install WPBP as a composer dependency, in a bedrock site, but can't get the autoloader to work. When I install my plugin with composer, its dependencies get installed in the vendor folder at the root of my project, amongst all other dependencies. Then this fails :

$my_plugin_libraries = require_once MP_PLUGIN_ROOT . 'vendor/autoload.php';

Any idea of how I could make this work in a composer managed project ?

Mte90 commented 2 years ago

Honestly I have no idea, I never used bedrock and wordpress under composer. I think that requires that the composer.json has some flag like "wordpress-plugin" so can put in the right folder but you should check in the bedrock documentation.

LucasDemea commented 2 years ago

You're right for the wordpress-plugin package type, but it doesn't help with the transitive dependencies being installed in the root vendor folder :/ Thanks anyway, I will keep looking for a solution.

Mte90 commented 2 years ago

I guess that for that is just matter of changing composer.json to deploy those library in the right path. I guess that bedrock install all the dependence on the root vendor in this way they are shared with all the packages inside wordpress.

pixelmultiplo commented 10 months ago

@LucasDemea did you ever find a solution?