Composer autoload order in bedrock


I try to use the php library
It´s not a plugin, it`s just a PHP Library

I added

"shelob9/jp-rest-cache": "dev-master"

to my composer.json file and it was installed in vendor.

But I get the error:

Fatal error: Call to undefined function add_filter() in /srv/www/ on line 27

So I think, it is included too early, so that the wordpress function “add_filter” has not yet been defined.

When I uncomment the line

add_filter( 'json_pre_dispatch', 'jp_rest_cache_get', 10, 2 );

in jp-rest-cache.php and add the line to the functions.php from my theme, everything works fine.

So my question is: Where are the files from composer installed php librarys included to my code, and how can I change the order?

Did you search for it in the code?

It’s called at the top of the main config:

You can try moving that later on in the loading process.