How to use 3d party packages from ext/vendor?

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
andreask
Registered User
Posts: 608
Joined: Fri Feb 27, 2009 6:13 pm
Name: Andreas

How to use 3d party packages from ext/vendor?

Post by andreask »

Hi,

Please excuse my ignorance.
I wont to use a 3d party package installed by composer to my ext/vendor but I do not know how to use it.

Do I just include() or do I go through config.yml.
And if the second case applies then are there any specific things I need to take care of?

An example would be hughly appreciated.

Thank you for your help!
Here is what I am working on right now...
Inactive User Manager for phpBB
Give it a try...
If you would like to buy me a bier ;) for my work I will drink it on a hot summer day and thank you!!!

User avatar
david63
Registered User
Posts: 17755
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: How to use 3d party packages from ext/vendor?

Post by david63 »

The first thing is that you need to have it as a requirement in your composer.json file (the details should be with the package)

Code: Select all

"require": {
        "php": ">=7.3.0",
        "composer/installers": "~1.0",
		"vendor/package": "^0.2.1"
    },
Then you will need to run composer to include it in your extension.

Then when you want to use it in your extension's files just have use vendor\package\class;
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

andreask
Registered User
Posts: 608
Joined: Fri Feb 27, 2009 6:13 pm
Name: Andreas

Re: How to use 3d party packages from ext/vendor?

Post by andreask »

Ah! I see!

Thank you very much david63!
Here is what I am working on right now...
Inactive User Manager for phpBB
Give it a try...
If you would like to buy me a bier ;) for my work I will drink it on a hot summer day and thank you!!!

User avatar
3Di
Former Team Member
Posts: 15427
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: How to use 3d party packages from ext/vendor?

Post by 3Di »

You should be able to use
$vendorClass = new \package\class;
$method = $vendorClass->method();

as an option, look at the vendor's docs.
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
:studio_microphone: Premium extensions @ The Studio

Post Reply

Return to “Extension Writers Discussion”