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?

1 Like

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 @ahmetbora 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 @ahmetbora,
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.

Any other way than a second composer json in plugins folder? I mean, that makes a composer based worklfow a little bit obsolet :wink: But I can’t figure out how to tell Kirby to run core first before the View lib…

Just for information if anybody is interested: if you use it as a git submodule or download it directly, the plugin works fine.
Would could be the reason it doesn’t work with composer? I’m not an composer expert :grimacing:

@FNGR2911 Not sure which of the two plugins you are talking abouut, but to me it seems that the beebmx one uses an outdated setup with an additonal config file:

An additional composer.json in the plugins folder should definitely not be necessary.

I’m talking about this one:

And yes, it seems that it also uses an outdated config file. Maybe it’ll help to that stuff into an index.php.

Hmm. Soon I will release several new features and a version that will correct this error.

@texnixe Should this be the correct use?



use Kirby\Cms\App as Kirby;

@include_once __DIR__ . '/vendor/autoload.php';

Kirby::plugin('afbora/blade', []);

@ahmetbora Yes, exactly, like in the documentation.

1 Like