TerrePorter / StringBladeCompiler

Render Blade templates from string
MIT License
175 stars 76 forks source link

Problem getting it to autload in Laravel 7 #63

Closed netm closed 2 years ago

netm commented 3 years ago

Hi there,

I have added this package to my project successfully:

When I try and render the example though I get:

return view (['template' => '{{$token}}'], ['token' => 'I am the token value']);

Error: strpos() expects parameter 1 to be string, array given
...
vendor/laravel/framework/src/Illuminate/View/ViewName.php:17

It looks to me like the package is not auto loading and replacing the view class?

If I run composer dump-autoload I get:

Deprecation Notice: Class Wpb\String_Blade_Compiler\Facades\StringBlade located in ./vendor/wpb/string-blade-compiler/src/Facade/StringBlade.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185

Any help much appreciated.

aprelvovanya commented 3 years ago

I temporarily switched to a branch revert-59-laravel-7-and-autoload-blade-custom-directives

TerrePorter commented 3 years ago

@netm @aprelvovanya I moved the revert-59 to a new branch, https://github.com/TerrePorter/StringBladeCompiler/tree/5.0

But i too am getting the error that you mentioned. It is because the view is not being taken over by the code and it is using the default view instead. Looking in to this currently.

TerrePorter commented 3 years ago

@netm I released a new version 5.0.1 that fixes that problem https://github.com/TerrePorter/StringBladeCompiler/releases/tag/5.0.1

Ryllaz commented 3 years ago

Same issue with Laravel v6.18.41 and StringBladeCompiler v6.0.2

TerrePorter commented 2 years ago

@Ryllaz can you create a new issue if your still having the problem. I missed your comment on this one. thanks