Composer packaging inside a plugin

Hello there, I’m writing a custom plugin and I’d like to include a library inside the composer system.

Is there any way to include it using composer require author/library without editing official Piwik’s composer.json ?

Hello, You need to add composer.json in your plugin and manually run composer install.

1 Like

Hi, I asked a similar question in this post.

I run a “composer require google/apiclient” inside my plugin directory plugins/MyPlugin. In the controller I added a

require “vendor/autoload.php”

but in the plugin classes I cannot access to Google_Client class. Are there documentation or examples about this kind of integration?

As far I can remember the best way to use composer is by namespaces.
I think you should use all the namespace path to google_client in that example you posted