In Backdrop CMS most contributed projects that depend on libraries include those libraries as part of the project. We call this "Bundling libraries".
People who use Backdrop can be confident that any module they enable or update using the Installer module (also known as Project browser) will work. Each module includes what it needs, or depends on another module that includes what it needs, and Backdrop manages all the dependencies.
Bundling libraries avoids these classic Drupal User eXperience problems:
- Enabling a module that does nothing (until a library is also installed)
- Needing to locate said library
(which could have moved or disappeared since last the module was updated) - Installing a different version of the library than intended
(maybe even one that has never been tested with the module) - Updating the module to a newer version may break the library integration
(this may also trigger #2 again, cause silent failures, or fatal errors)
Shared Libraries
When libraries are common, or needed for multiple projects, there are several solutions:
A primary module
This is the recommended approach. Creating one primary module that bundles the library and provides basic functionality like user interfaces, global settings, or authentication with an external service.
Other modules that also need the library will depend on the primary module, and could even lock to a specific version to ensure compatibility. The Stripe module is a good example of this.
A library-only module
Another approach would be moving a library into a stand-alone module that only adds the library, but does nothing else.
Other modules that also need the library will depend on the stand-alone module. This approach is recommended only when there is no basic or shared functionality between modules that use the library, or when it's not clear what the "primary" project would be.
Use the Libraries API module
The Libraries API module was the recommended approach for managing libraries in Drupal 7. This module is also available for Backdrop. It provides a user interface to let people know if they need to install additional libraries, or if there are any problems with compatibility. Unfortunately, there is no interface for installing or updating these libraries. That step still needs to be done by manually moving the code from place to place.
Using Libraries API module is only recommended when a library is not GPL-compatible, and cannot be bundled with any Backdrop project.
Use composer
There is a module called Composer Manager that can be used to manage dependencies.
This approach is only recommended when the Installer module (Project browser) is disabled, and when a site's modules are managed strictly by developers. Patches may also be required to make contrib projects compatible with composer manager.
Contrib can do whatever it likes
Though contrib is a place where maintainers may choose do whatever they please, we encourage contributors to keep our values in mind: "Backdrop values the needs of the editor and architect over the needs of the developer."