Require /vendor/autoload.php from config hook

Hello,

I am trying to use mailchimp library to interact with their API.

To use the library I need to:

require_once('/path/to/MailchimpMarketing/vendor/autoload.php');

…the path to autoload is actually /vendor/autoload.php with /vendor/ being at the root of the kirby site, next to content, site, etc.

So, how to require that file from inside a config hook ?

thank you

Actually I just noticed that having /vendor/ at the site’s root makes kirby go boom!

What would be the prefered way to install a package with composer then ?

This is the library I was trying to work with: https://github.com/mailchimp/mailchimp-marketing-php

Thank you

It makes more sense to crete a plugin, then in that plugin’s index file, require the library.

1 Like