afbora / kirby-blade

Enable Laravel Blade Template Engine for Kirby 3
MIT License
20 stars 7 forks source link

Illuminate/Kirby redeclaring the `e()` function #11

Closed adamkiss closed 4 years ago

adamkiss commented 5 years ago

Just installed this plugin, I can't even load a page (any page), because there is a conflict with the e() function between Kirby and Illuminate.

PHP Fatal error:  Cannot redeclare e() (previously declared in /---/vendor/illuminate/support/helpers.php:607) in /---/kirby/config/helpers.php on line 162

I have absolutely no idea how to deal with this.

Thank you

adamkiss commented 5 years ago

Ah, now I saw the issue on the Kirby Forum - should I close this one?

For posterity - the issue is that if the composer creates an autoloader where kirby's e() function isn't created first, PHP will fail with FATAL_ERROR.

Since you can't force the composer to use a load order AFAIK, the only solution seems to be to download this plugin to site/plugins or use git submodule as a way of includeing this plugin.

afbora commented 4 years ago

as @lukasbestle said on forum:

Unfortunately no. Libraries that define the same helpers are not compatible with each other.

https://forum.getkirby.com/t/problem-using-blade-plugin/14853/28

only solution seems to be to download this plugin to site/plugins or use git submodule as a way of includeing this plugin.

Exactly!

adamkiss commented 4 years ago

@afbora Do you think it's possible to just… not add the helpers? I'm not familiar enough with this codebase, but as I see it, composer installation right now just isn't really a viable option, since you can't ensure the order, right?

What actually uses the illuminate/support/helpers? Something internal, or is it available in templates? Otherwise, It'll be good idea to put a warning somewhere in the readme, I think. (I can PR that)

iskrisis commented 4 years ago

😢

afbora commented 4 years ago

I have great news for you 🎉 https://github.com/getkirby/kirby/pull/2829