A function that can render Blade on the fly.
felixdorn/laravel-render-blade-string is a Laravel package for a function that can render blade on the fly. .
It currently has 5 GitHub stars and 1.411 downloads on Packagist (latest version 1.1.1).
Install it with composer require felixdorn/laravel-render-blade-string.
Discover more Laravel packages by felixdorn
or browse all Laravel packages to compare alternatives.
Last updated
DISCLAIMER: This package won't support Laravel 9.x and future versions as this is now part of the framework, see Blade::render.
Requires PHP 8.0.0+
You can install the package via composer:
composer require felixdorn/laravel-render-blade-string
This function evaluates PHP code (using eval()). This should not be a security issue unless you write the following
code.
__renderBlade($request->get('blade'));
The double underscores in the function name are here to remind you that this a somewhat dirty hack and you should try to avoid doing this as much as possible.
__renderBlade('@if ($something) Yo! @endif', [
'something' => true
]);
composer test
Laravel Render Blade String was created by Félix Dorn under the MIT license.