lexdubyna
lexdubyna
Without args: $blade->compiler()->compileString($string); With args: ``` function renderFromString(string $string, array $params): string { $generated = $blade->compiler()->compileString($string); ob_start() and extract($params, EXTR_SKIP); try { eval('?>' . $generated); } catch (\Exception $e) {...
If this package were updated to use `illuminate/view: ^9.0`, this could be done in one line. https://laravel.com/docs/9.x/blade#rendering-inline-blade-templates
I was able to set up `x-` components but it's very verbose (since I am trying to show multifile solution in one post) and probably not correct way to do...
Ok, I forked this repo and made some updates to be able to use components (class-based and anonymous) https://github.com/lexdubyna/blade
@kaspost You can check out how I implemented `compileString` in my forked version of this package: https://github.com/lexdubyna/blade/blob/master/src/Blade.php#L133 Also, I'm not sure whether it's a good idea to put `ob_start` and...
@kaspost I have not yet tested x-components compiled from string. Will look into it.
@Marvellous890 This is my test folders structure that works: ``` app Components MediaImage.php views compiled components anonymous alert.php media-image.blade.php ``` and code: ```php $blade = new Lexdubyna\Blade\Blade( [get_template_directory() . '/views'],...
Have you tried using `@include()`