Page 1 of 1

Third party libraries

Posted: Wed Aug 27, 2014 7:40 am
by martti
How to include third party libraries? ( Imagine for example).
With composer, all third parties are centralised in /vendor and classes would be autoloaded but extensions have no control over that.
Creating a dedicated extension for each library with services? Where to put the files? Composer can't be used?

Re: Third party libraries

Posted: Wed Aug 27, 2014 7:54 am
by MattF
Sure you can. All extensions use composer.

viewtopic.php?f=461&t=2256031&p=13695791

Re: Third party libraries

Posted: Wed Aug 27, 2014 8:19 am
by martti
Thanks, I overlooked that topic.

Re: Third party libraries

Posted: Wed Aug 27, 2014 8:28 am
by martti
Would it then be a good idea to create an extension for each library? Kind of like Symfony2 Bundles.
That would be 'Library extentions'. Extensions that create no direct functionality for the board but only for other extensions.

Re: Third party libraries

Posted: Wed Aug 27, 2014 8:41 am
by martti
Hmm, I see the downside is that admins have to activate these 'Library extensions' and the extension list would grow big in the acp.

Re: Third party libraries

Posted: Wed Dec 24, 2014 11:39 pm
by D@ve
I decided to create a "common" extension for classes an files I use in more than one extension.

Or is there a way to move files to the third party folder?

Re: Third party libraries

Posted: Mon Dec 29, 2014 10:17 am
by Wolfsblvt
I had the same issue and question and talked to some of the phpBB developers several times.
There is no way something like a "library extension" will be validated, so accepted to the extension database. Cause what should they test? There is nothing the extension really does other then providing functions and libraries.

The way you should go is: You should include all dependencies you need with composer, so auto-loading them. If they can't be autoloaded, include them manually in the \vendor folder.

Also for your own libraries and re-used functions. Create a library package with composer.json, so make it autoload-able and include it this way. You can include your library in every extension of yours and you can keep it up to date through composer.

Re: Third party libraries

Posted: Sun Jan 04, 2015 2:26 pm
by D@ve
There is no way something like a "library extension" will be validated, so
As long as the extension that will use the "librariy extensions" will be validated I don't care.

I'm using stuff like an ajax framework, or WYSIWYG libraries. These are not even small so if I use them in more than one extension I see no reason to include them in any extension...

regards, Dave

Re: Third party libraries

Posted: Sun Jan 04, 2015 4:04 pm
by Wolfsblvt
D@ve wrote:As long as the extension that will use the "librariy extensions" will be validated I don't care.

I'm using stuff like an ajax framework, or WYSIWYG libraries. These are not even small so if I use them in more than one extension I see no reason to include them in any extension...
Every extension should work on its own. (Except it is an addon to an existing extension)
That is the rule.
I am no validator, but I think I have heard that an extension has to contain everything it needs to work on its own.

Is there any problem with including your libraries with composer in every extension?

Re: Third party libraries

Posted: Mon Jan 05, 2015 8:02 pm
by D@ve
As I said... Some Libraries are quit huge and it's more complicated to maintain differnt extensions.

e.g. I have a CMS mod at the moment. With Chat, Statistics, seo URLs etc. I haven't published it yet, just use it in my own project. I was going to convert all of it in single extensions and publish it here... But much code is based on some basic classes and (external) libraries.

In the end I would have 10 extensions that each brings an overhead of 8 MB of stuff with it that is actually needed just once.

So I definitley WILL have a basic extension. Thats easier to maintain for me. If it won't be accepted here... so be it... I primariily need it for myself. Would be ashame

regards, Dave