3rd Party Plugin-Dependencies (composer)


i went through Plugin Basics | Kirby CMS but didn’t find an answer for how to handle 3rd party dependencies in my plugin. In my case i created a plugin for file conversions which in turn relies on a 3rd party API.

If a add the 3rd party lib to the plugins composer.json a vendor directory is created and all is fine. As i don’t want to check in this vendor directory i am wondering what the intended workflow is to add the dependency? I don’t want to add it to the parent composer.json.

Any link or help is appreciated.

Thanks, Thomas

Hey Thomas,

I fear you’ll have to check in the vendor directory. You can find a good tutorial here: Plugin setup with Composer dependencies | Kirby CMS as you will see, there is a gitignore file which will ignore most of the stuff within vendor, so it’s mainly your needed 3rd party deps in there.

For my setup I also use a “special” composer build script, excluding all the dev dependencies, which basically does composer install --no-dev --optimize-autoloader so there won’t be my local K3.6 test install or phpunit in the vendor dir, when pushing to github.

yeah. we kind of agreed to do this for plugins so download from repo as zip, git submodule and composer all work. its not standard dev practice but works well for plugins and is easy to do. i usually have composer scripts to make this faster for me.

if you would not want to do it this way you could create a custom build that includes the vendor folder and upload that when doing a release manually. at least i think that should work.