In Drupal 7, there are hook_library()
and drupal_add_library()
that can be used to manage JS and CSS libraries. I am looking for how to include the PHPExel library in my distribution.
How can I do it?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityhook_library()
is thought only for Javascript and CSS files; for PHP libraries, you should consider the Library API module.
This module introduces a common repository for libraries in sites/all/libraries resp. sites//libraries for contributed modules.
External libraries
Denotes libraries ("plugins") that are neither shipped nor packaged with a project on drupal.org. We do not want to host third-party libraries on drupal.org for a multitude of reasons, starting with licensing, proceeding to different release cycles, and not necessarily ending with fatal errors due to conflicts of having the same library installed in multiple versions. Drupal 7 only has built-in support for non-external libraries via hook_library(). But it is only suitable for drupal.org projects that bundle their own library; i.e., the module author is the creator and vendor of the library. Libraries API should be used for externally developed and distributed libraries. A simple example would be a third-party jQuery plugin.
The Library API module implements an API that can be used from third-party modules to load libraries installed on a Drupal site; the pro of using Library API is that it handles dependencies between libraries, and versioning.
I am not too sure if this operation is going to work for custom php libraries but I have used this procedure for importing custom css and js files into my project.
In summary, I guess the libraries module should enable you to automatically import custom php, css and js libraries and so on into your project