I want to invoke this PSR-4 PHP package, which is recommended to be installed by composer, because it has many dependencies and an autoload.php file. I've no idea to do call it in a custom Moodle plugin? Are there any examples?
General developer forum
How to invoke a PSR-4 PHP package in a custom Moodle plugin?
Go to the directory that contains your plugin (for example mod/wechat/) and give the command:
composer require overtrue/wechat
It will automatically create the following files and directories:
For example in mod/wechat/view.php:
// You can now access the API provided by the package:
$foo = new \Some\Example\Class($some, $parameters); $foo->doSomething();