Problem Using Blade Plugin

Hi together,
after installing the new blade plugin I get the following error message:

Cannot redeclare e() (previously declared in /.../vendor/illuminate/support/helpers.php:607) in /.../kirby/config/helpers.php on line 154

I dare, that it has someting to do width the laraval, valet server.

Is there maybe a good workaround?

I seem to remember running into this myself when i tried it months ago, also on Valet but i dont think that was the problem. i did solve it but i cant remember how. All i can suggest is trying the version of the starterkit made by the same people that includes Blade, and compare to see if you have set it up properly.

You can use the new improved plug-in:

I was using the blade plugin by @beebmx. This worked fine an then I updated to the new on. Since then, the problem started.

Now I downloaded a fresh starterkit added the blade plugin via composer:

composer require afbora/kirby-blade

… and got the same error.

the beebmx/kirby-starterkit is working with Kirby-env an I dont wanted to work with a build process or seperated src and public folder. But there is no illuminate Folder and no conflict so.

Are you sure? Because e() function checks to prevent conflict in helpers.php.

And we modify e() and override function with _e() like that:

Did you try following actions that found similiar issues in StackOverflow?

composer global remove laravel/valet
composer global require laravel/valet


This might help you, try deleting the composer.lock file and the vendor directory and then do a composer update.

Thank you @byybora for fast reply!
I tried both but it still gives me the error message?!

Could you share us the vendor/illuminate/support/helpers.php and composer.json file? And can you check which version you are using illuminate/support?

  - Installing illuminate/support (v5.8.27): Loading from cache

is any of them required:

illuminate/support suggests installing moontoast/math (Required to use ordered UUIDs (^1.1).)
illuminate/support suggests installing ramsey/uuid (Required to use Str::uuid() (^3.7).)
illuminate/support suggests installing symfony/process (Required to use the composer class (^4.2).)
illuminate/support suggests installing symfony/var-dumper (Required to use the dd function (^4.2).)
illuminate/support suggests installing vlucas/phpdotenv (Required to use the env helper (^3.3).)

Now I realize why the error was caused. It loads the Laravel library on your system before the Kirby application. Kirby core files need to be loaded first for blade plugin work stable.

I guess you load the kirby and kirby-blade repository from root composer. Try to install blade plugin from /site/plugins folder.

1 Like

Thanks @byybora,
that did the trick. It was’nt clear to me that I should have to install a own composer for plugins.
I hope I didn’t waste your Time,
thanks again @TakioTk

You’re wellcome.

Other plugins may not cause such a problem.
The problem with this plugin was that Kirby and Illuminate use the same method.