PHP Library in controller?


#1

Hey there,

I am trying to use data I have from elasticsearch to display some graphs on a piwik dashboard and I am trying to make a plugin collection of widgets for that.

How can I use a third party library like this one in the controller of a plugin from that comes from composer?

I don’t think adding it as a composer style require in the plugin.json does any good.

Any pointers would be appreciated. I think I’m just being rusty with php and dense at the moment.

For those looking for this in the future: I was just being dense. I installed it using composer to the plugin directory and added the following to the top of my controller after the namespace.


require_once __DIR__ . '/vendor/autoload.php';
use ElasticSearch\Client;