# Problem Using Blade Plugin

**URL:** <https://forum.getkirby.com/t/problem-using-blade-plugin/14853>\
**Category:** Questions\
**Tags:** v3\
**Created:** [July 8, 2019, 8:48am UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853 "2019-07-08T08:48:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![TakioTk](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/takiotk/32/3133_2.png) [@TakioTk](https://forum.getkirby.com/u/TakioTk)\
**Post date:** [July 8, 2019, 8:48am UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853/1 "2019-07-08T08:48:06Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jimbobrjames](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jimbobrjames/32/5802_2.png) [@jimbobrjames](https://forum.getkirby.com/u/jimbobrjames)\
**Post date:** [July 8, 2019, 9:17am UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853/2 "2019-07-08T09:17:24Z")

</div>

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.

> **[beebmx/kirby-starterkit](https://github.com/beebmx/kirby-starterkit)**
>
> Starter Kit for Kirby 3. Contribute to beebmx/kirby-starterkit development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![ahmetbora](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ahmetbora/32/11671_2.png) [@ahmetbora](https://forum.getkirby.com/u/ahmetbora)\
**Post date:** [July 8, 2019, 10:37am UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853/3 "2019-07-08T10:37:45Z")

</div>

You can use the new improved plug-in:

> **[afbora/kirby-blade](https://github.com/afbora/kirby-blade)**
>
> Enable Laravel Blade Template Engine for Kirby 3. Contribute to afbora/kirby-blade development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![TakioTk](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/takiotk/32/3133_2.png) [@TakioTk](https://forum.getkirby.com/u/TakioTk)\
**Post date:** [July 8, 2019, 11:15am UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853/4 "2019-07-08T11:15:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ahmetbora](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ahmetbora/32/11671_2.png) [@ahmetbora](https://forum.getkirby.com/u/ahmetbora)\
**Post date:** [July 8, 2019, 11:48am UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853/5 "2019-07-08T11:48:43Z")

</div>

> <https://github.com/illuminate/support/blob/master/helpers.php#L237>

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

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

> <https://github.com/afbora/kirby-blade/blob/master/helpers.php>

---

<div class="post-metadata">

**Author:** ![ahmetbora](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ahmetbora/32/11671_2.png) [@ahmetbora](https://forum.getkirby.com/u/ahmetbora)\
**Post date:** [July 8, 2019, 11:56am UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853/6 "2019-07-08T11:56:25Z")

</div>

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

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

or

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

---

<div class="post-metadata">

**Author:** ![TakioTk](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/takiotk/32/3133_2.png) [@TakioTk](https://forum.getkirby.com/u/TakioTk)\
**Post date:** [July 8, 2019, 1:33pm UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853/7 "2019-07-08T13:33:22Z")

</div>

> [@ahmetbora](#):
>
> composer global require laravel/valet

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

---

<div class="post-metadata">

**Author:** ![ahmetbora](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ahmetbora/32/11671_2.png) [@ahmetbora](https://forum.getkirby.com/u/ahmetbora)\
**Post date:** [July 8, 2019, 1:47pm UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853/8 "2019-07-08T13:47:35Z")

</div>

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`?

---

<div class="post-metadata">

**Author:** ![TakioTk](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/takiotk/32/3133_2.png) [@TakioTk](https://forum.getkirby.com/u/TakioTk)\
**Post date:** [July 8, 2019, 2:04pm UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853/9 "2019-07-08T14:04:23Z")

</div>

```
  - 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).)
```

---

<div class="post-metadata">

**Author:** ![TakioTk](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/takiotk/32/3133_2.png) [@TakioTk](https://forum.getkirby.com/u/TakioTk)\
**Post date:** [July 8, 2019, 2:08pm UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853/10 "2019-07-08T14:08:08Z")

</div>

> **[Firefox Send](https://send.firefox.com/download/3885e045320eb19f/#GObgKeX5LNHuJwgCl38Caw)**
>
> Encrypt and send files with a link that automatically expires to ensure your important documents don’t stay online forever.

---

<div class="post-metadata">

**Author:** ![ahmetbora](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ahmetbora/32/11671_2.png) [@ahmetbora](https://forum.getkirby.com/u/ahmetbora)\
**Post date:** [July 8, 2019, 2:26pm UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853/11 "2019-07-08T14:26:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![TakioTk](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/takiotk/32/3133_2.png) [@TakioTk](https://forum.getkirby.com/u/TakioTk)\
**Post date:** [July 8, 2019, 2:51pm UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853/12 "2019-07-08T14:51:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ahmetbora](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ahmetbora/32/11671_2.png) [@ahmetbora](https://forum.getkirby.com/u/ahmetbora)\
**Post date:** [July 8, 2019, 2:58pm UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853/13 "2019-07-08T14:58:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![FNGR2911](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/fngr2911/32/7485_2.png) [@FNGR2911](https://forum.getkirby.com/u/FNGR2911)\
**Post date:** [October 22, 2019, 2:48pm UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853/14 "2019-10-22T14:48:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![FNGR2911](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/fngr2911/32/7485_2.png) [@FNGR2911](https://forum.getkirby.com/u/FNGR2911)\
**Post date:** [October 23, 2019, 7:21am UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853/15 "2019-10-23T07:21:59Z")

</div>

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 😬

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [October 23, 2019, 7:43am UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853/16 "2019-10-23T07:43:46Z")

</div>

@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: [https://getkirby.com/docs/guide/plugins/plugin-setup-basic#the-index-php](https://getkirby.com/docs/guide/plugins/plugin-setup-basic#the-index-php)

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

---

<div class="post-metadata">

**Author:** ![FNGR2911](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/fngr2911/32/7485_2.png) [@FNGR2911](https://forum.getkirby.com/u/FNGR2911)\
**Post date:** [October 23, 2019, 8:00am UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853/17 "2019-10-23T08:00:35Z")

</div>

I’m talking about this one: [https://github.com/afbora/kirby-blade](https://github.com/afbora/kirby-blade)

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

---

<div class="post-metadata">

**Author:** ![ahmetbora](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ahmetbora/32/11671_2.png) [@ahmetbora](https://forum.getkirby.com/u/ahmetbora)\
**Post date:** [October 23, 2019, 8:31am UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853/18 "2019-10-23T08:31:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ahmetbora](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ahmetbora/32/11671_2.png) [@ahmetbora](https://forum.getkirby.com/u/ahmetbora)\
**Post date:** [October 25, 2019, 7:57am UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853/19 "2019-10-25T07:57:03Z")

</div>

@texnixe Should this be the correct use?

**/site/plugins/kirby-blade/index.php**

```php
<?php

use Kirby\Cms\App as Kirby;

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

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

```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [October 25, 2019, 8:06am UTC](https://forum.getkirby.com/t/problem-using-blade-plugin/14853/20 "2019-10-25T08:06:44Z")

</div>

@ahmetbora Yes, exactly, like in the [documentation](https://getkirby.com/docs/guide/plugins/plugin-setup-composer).

[Next page](https://forum.getkirby.com/t/problem-using-blade-plugin/14853.md?page=2)
