7 – How to use function libraries

After installing the module and libraries, and putting MailJet Library for sites / all / libraries Make sure your structure as:





sites / all / library / mailjet / src / Mailjet / Client.php
sites / all / library / mailjet / src / Mailjet / Config.php
sites / all / libraries / mailjet / src / Mailjet / Request.php
sites / all / library / mailjet / src / Mailjet / Resources.php
sites / all / libraries / mailjet / src / Mailjet / Response.php

And then implement hook_libraries_info like the next

/ **
* Implement hook_libraries_info ().
* /
myModule_libraries_info () {function
$ libraries['mailjet'] = array (
& # 39; name & # 39; => & # 39; mailjet & # 39 ;,
& # 39; vendor url & # 39; => & # 39; https: //github.com/mailjet/mailjet-apiv3-php&#39 ;,
& # 39; download url & # 39; => & # 39; https: //github.com/mailjet/mailjet-apiv3-php/archive/master.zip&#39 ;,
// version arguments is important, the version of mailjet libary can be found in the Config.php file on line 19.
& # 39; version arguments & # 39; => array (
& # 39; file & # 39; => & # 39; src / Mailjet / Config.php & # 39 ;,
& # 39; pattern & # 39; => & # 39; / v + ( d + .  D + .  D +) / & # 39 ;,
& # 39; lines & # 39; => 19,
)
& # 39; files & # 39; => array (
& # 39; php & # 39; => array (
& # 39; src / Mailjet / Client.php & # 39 ;,
& # 39; src / Mailjet / Config.php & # 39 ;,
& # 39; src / Mailjet / Request.php & # 39 ;,
& # 39; src / Mailjet / Resources.php & # 39 ;,
& # 39; src / Mailjet / Response.php & # 39 ;,
)
)
);
return $ libraries;
}

Now you can upload your library as

$ library = raries_load (& # 39; mailjet & # 39;);
yes ($ library['loaded']) {
dsm ("loaded");
}
else {
dsm (& # 39; not loaded & # 39;);
}