11

We use a number of 3rd party open source products such as PhpExcel and HtmlPurifier. In the past we have always had a separate folder for them and called them accordingly, but would now like to know if there's a more conventional way of installing/using them with the Joomla \libraries folder.

I've look at Using own library in your extensions, but am not clear on whether this applies literally to writing your own library, or if it can be generally used with "whatever is in the folder". I'm hoping for some suggestions or insight before I begin this R&D, but will update with findings otherwise.

  • 1
    I think the method you use depends on when you want to import your library. If it's a library you only wish to import with a specific component then using @FFrewin's method would be best. If you want to import your library so that's it's constantly being used on every page, I would suggest you use JLoader in a plugin event to autoload it – Lodder Dec 2 '14 at 10:21
  • This should apply to whatever is in the folder, but anything added here should apply to Joomla coding conventions. This would include strict enforcement of files containing only a single class, etc. If you're including something third party, that would likely require it to be modified before using it. – Jeremy Proffitt Dec 3 '14 at 8:56
5

I can't comment if there is a conventional way, but my thinking is that it really makes sense to use the libraries folder for this purpose and I have seen others doing the same.

Personally I have used the libraries folder in the same way, and later on my extension I usually load the library with the jimport function.

Like this for example:

jimport('simplehtmldom.simple_html_dom');

it will include the php file:

"/libraries/simplehtmldom/simple_html_dom.php"

  • Accidentally accepted too soon....looks about right to me, but want keep the question unanswered to see what other feedback there is for & by anyone. Will likely accept then :) – GDP Dec 1 '14 at 16:37
  • no worries... I am also hoping to see more and even more thorough answers on this nice question. – FFrewin Dec 1 '14 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.