Including composer package

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
Autumn Shade
Registered User
Posts: 29
Joined: Thu May 30, 2019 12:38 pm

Including composer package

Post by Autumn Shade » Thu Jun 13, 2019 6:51 am

Greetings.

I've tried including composer package into my extension package, but it seems to not autoload the classes correctly, so I am not able to use them correctly. The namespacing is okay, I've tried embedding into the project, although I don't think that's how it works. Can somebody with some experience, who created an extension using some 3rd-party composer packages help up?

Best Regards!

User avatar
david63
Registered User
Posts: 16545
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Including composer package

Post by david63 » Thu Jun 13, 2019 7:12 am

Not quite sure what it is that you are trying to do.

Are you trying to get your extension to auto load via composer - if so then that is not possible at the moment (phpBB 3.3 or 4.0 will have that functionality) for now you have to run composer locally to create a vendor folder that you include with your extension.

If that is not what you mean then please explain exactly what the problem is.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
Autumn Shade
Registered User
Posts: 29
Joined: Thu May 30, 2019 12:38 pm

Re: Including composer package

Post by Autumn Shade » Thu Jun 13, 2019 7:14 am

Yeah, that's what I was trying to guess, why does phpbb does not load automatically with Symfony kernel the external dependencies. I did it by loading the classmap into the composer.json and making sure the path to the vendor is correctly set.

User avatar
david63
Registered User
Posts: 16545
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Including composer package

Post by david63 » Thu Jun 13, 2019 7:22 am

Autumn Shade wrote:
Thu Jun 13, 2019 7:14 am
why does phpbb does not load automatically with Symfony kernel the external dependencies
Sorry but that decision is above my pay grade.

As I said before it will be in a future version.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 25388
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Including composer package

Post by Paul » Thu Jun 13, 2019 9:09 am

You should run composer install on your extension itself. This will generate a vendor folder within your extension, and this should be included when you add your extension to the ext/ folder. All files from this vendor/ folder are autoloaded by phpBB.

What David is talking about is installing actual extension with composer. That is something that will be included in phpBB 4.0 (And at that moment it is also no longer needed to include the vendor/ folder in the extension itself).
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

Post Reply

Return to “Extension Writers Discussion”