Home

***Drupal 8 core has introduced improved library management tools (libraries.yml and unified library loading) leaving some to wonder why the Libraries API module is still needed. Despite these changes core still does not offer a solution for handling external library dependencies that may be shared across multiple extensions, which is the main problem space the Libraries API project continues to focus on. Any projects that depend on external and/or shared libraries can benefit from several important advantages Libraries API provides, including:

  1. Avoiding load conflicts. Drupal 8 core does not offer a way for common library dependencies (e.g. a commonly used javascript library) to be declared canonically. If multiple extensions declare the same dependency via core's APIs alone a variety of conflicts can occur (version issues, double-inclusion errors, etc.). Libraries API provides a central framework to avoid these problems while leveraging Drupal core's native APIs for actual library loading.
  2. Centralized maintenance of library metadata. Unlike the Drupal 7 versions of Libraries API, library metadata is now decoupled from the extensions that use it. This metadata (previously defined in hook_libraries_info()) is instead read from a common shared registry that can be accessed remotely and transparently. This will provide numerous advantages including greater consistency for site builders using different versions of library-dependent modules.
  3. An extended API and toolkit for developers. Tools for version detection, configurable management of library sources and other benefits that have always been part of the Libraries API project are still available and do not need to be duplicated.

Libraries API 3.x uses core's asset management APIs directly by registering asset libraries on behalf of other extensions. This means that, despite the project name, developers do not have to learn a whole new API to take advantage of these benefits.

Historical note: Many of the background notes used to explain the philosophy of the 7.x-2.x version also apply to 8.x-3.x.

Note on PHP libraries: With Drupal 8 relying on Composer for autoloading and dependency resolution of PHP libraries, asset libraries are the primary use-case for Libraries API, though basic support for management and loading of PHP libraries is still included.

Folwell Theme Website

text

Heading 2

Note on PHP libraries: With Drupal 8 relying on Composer for autoloading and dependency resolution of PHP libraries, asset libraries are the primary use-case for Libraries API, though basic support for management and loading of PHP libraries is still included.