Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-49672

Policy: Include third-party libraries using composer



    • Improvement
    • Status: Open
    • Critical
    • Resolution: Unresolved
    • 2.9
    • None
    • Policy


      Composer has become very popular in the past few years, and it's easy to see why. It's made the act of installing and using libraries incredibly simple, and helped with standardising use of namespaces and autoloaders.

      There have been proposals in the past to make Moodle itself available as a composer package, but I do not feel that this would be the right fit. Moodle is, after all, the application, it is not the library.

      However, I feel that we should be able to use it as a way of installing third-party libraries which we use within Moodle. In order to help people use libraries in a standard way, we should also standardise how it is included.

      So my proposal is that we:

      1. allow core use of the existing composer.json file in /composer.json with installation of packages to /vendor/
      2. should specify a fixed version of each library, and ensure correct generation of the composer.lock
      3. modify the Moodle autoloader to make use of the /vendor directory and include its vendor/autoload.php file
      4. only support use of Composer for core use and not in Plugins at this time.

      This will allow us to move the management of many of the third-party libraries to composer.


      1. Because its' a library world;
      2. We should be using the clients and libraries available to us;
      3. We shouldn't be managing their dependencies manually;
      4. We should make it easy for ourselves to upgrade libraries.


        Issue Links



              Unassigned Unassigned
              dobedobedoh Andrew Lyons
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              28 Vote for this issue
              34 Start watching this issue