How do we deal with/install dependencies?

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
JoshyPHP
Code Contributor
Posts: 1157
Joined: Mon Jul 11, 2011 12:28 am

How do we deal with/install dependencies?

Post by JoshyPHP »

I'm writing an extension that depends on a package available on Packagist. How am I supposed to handle it? Most end users can't even run Composer in command line so I presume there must be another way?
I wrote the thing that does BBCodes in 3.2+.
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 26730
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: How do we deal with/install dependencies?

Post by Paul »

You should include in your composer.json, and package the vendor directory with your extension.
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development
User avatar
JoshyPHP
Code Contributor
Posts: 1157
Joined: Mon Jul 11, 2011 12:28 am

Re: How do we deal with/install dependencies?

Post by JoshyPHP »

Thanks for your quick answer. I have a follow-up if you don't mind; How do you deal with autoloading? Does it have to be handled by the extension itself?
I wrote the thing that does BBCodes in 3.2+.
User avatar
nickvergessen
Former Team Member
Posts: 4397
Joined: Mon Apr 30, 2007 5:33 pm
Location: Stuttgart, Germany
Name: Joas Schilling
Contact:

Re: How do we deal with/install dependencies?

Post by nickvergessen »

No Support via PM
User avatar
JoshyPHP
Code Contributor
Posts: 1157
Joined: Mon Jul 11, 2011 12:28 am

Re: How do we deal with/install dependencies?

Post by JoshyPHP »

I've read this topic and it seems to indicate that you need to run composer in command-line to use its autoloader. Is that correct?
I wrote the thing that does BBCodes in 3.2+.
User avatar
nickvergessen
Former Team Member
Posts: 4397
Joined: Mon Apr 30, 2007 5:33 pm
Location: Stuttgart, Germany
Name: Joas Schilling
Contact:

Re: How do we deal with/install dependencies?

Post by nickvergessen »

Well you can just add the autoload.php together with your dependencies.

Example from my newspage extension:
https://github.com/nickvergessen/phpbb- ... r.json#L18

On releasing I, as extension author, run the composer command and then generate the zip.
This zip then contains an additional vendor folder (from composer) which contains a composer and nickvergessen folder aswell as the autoload.php file.

The administrators installing the extension, do not need to run composer themselves.
No Support via PM
User avatar
JoshyPHP
Code Contributor
Posts: 1157
Joined: Mon Jul 11, 2011 12:28 am

Re: How do we deal with/install dependencies?

Post by JoshyPHP »

Ok. So extensions need to bundle their dependencies and their autoloader.

About your extension phpbb-ext-newspage, I looked into it earlier because that's the first extension I found that had dependencies listed in composer.json. Its latest release doesn't contain a vendor folder with phpbb-tool-trimmessage, I assume it's because you want it to be optional?
I wrote the thing that does BBCodes in 3.2+.
User avatar
nickvergessen
Former Team Member
Posts: 4397
Joined: Mon Apr 30, 2007 5:33 pm
Location: Stuttgart, Germany
Name: Joas Schilling
Contact:

Re: How do we deal with/install dependencies?

Post by nickvergessen »

JoshyPHP wrote:Ok. So extensions need to bundle their dependencies and their autoloader.

About your extension phpbb-ext-newspage, I looked into it earlier because that's the first extension I found that had dependencies listed in composer.json. Its latest release doesn't contain a vendor folder with phpbb-tool-trimmessage, I assume it's because you want it to be optional?
No the github download is not the release and I did not put a release yet out there.
No Support via PM
User avatar
JoshyPHP
Code Contributor
Posts: 1157
Joined: Mon Jul 11, 2011 12:28 am

Re: How do we deal with/install dependencies?

Post by JoshyPHP »

Oh, ok. GitHub tricked me.
I wrote the thing that does BBCodes in 3.2+.
Post Reply

Return to “Extension Writers Discussion”