Vendor

Component ID

2363075

Component name

Vendor

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

Add a vendor subfolder to your sites/all folder. The vendor module adds zero config autoloading support for any PSR-0 compatible library classes in that folder.

If you want to use third party libraries in your custom modules, just add the code drupal_load('module', 'vendor') in your MYMODULE.module file to make sure the vendor module is loaded before your own module. Your library classes will now be loaded without any need to configure them.

For proper error handling, all MYMODULE.module files that references one or more classes from the sites/all/vendor folder should have the following format :

if(drupal_load('module', 'vendor')) {
    // Do stuff
} else {
    drupal_set_message(t("The Vendor module failed to load!"), 'error');
}