General developer forum

Managing Plugin Dependencies

Picture of Brian Beach
Managing Plugin Dependencies

Hi, I am developing a plugin. My plugin has dependencies on the AWS SDK for PHP. What is the best way to include a library in a plugin? I don't want to include the entire SDK in my plugin source. It's much bigger than my plugin and I don;t want to update my plugin each time AWS updates the SDK (which is very often). At the moment  am using the install.php to pull the SDK. For example:

function xmldb_appstream_install() {

  file_put_contents("../mod/appstream/aws.phar", fopen("", 'r'));


However this feels a bit brute force. Does Moodle support a package system? For example, would Moodle automatically install the packages listed in the requires section of composer.json or similar?


Average of ratings: -
Picture of Darko Miletić
Re: Managing Plugin Dependencies
Core developersParticularly helpful Moodlers

There is an open source plugin that packages AWS PHP SDK 3.19.26 for Moodle.

I suggest to use that for your project.

Average of ratings: -