felixdorn / laravel-render-blade-string
A function that can render Blade on the fly.
Installs: 1 402
Dependents: 2
Suggesters: 0
Security: 0
Stars: 5
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3
- orchestra/testbench: ^6.24
- pestphp/pest: ^1.21
- phpstan/phpstan: ^1.4
- symfony/var-dumper: ^5.4
This package is auto-updated.
Last update: 2024-12-11 19:18:03 UTC
README
DISCLAIMER: This package won't support Laravel 9.x and future versions as this is now part of the framework, see Blade::render
.
Render Blade on the fly.
Installation
Requires PHP 8.0.0+
You can install the package via composer:
composer require felixdorn/laravel-render-blade-string
Disclaimer
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.
Usage
__renderBlade('@if ($something) Yo! @endif', [ 'something' => true ]);
Testing
composer test
Laravel Render Blade String was created by Félix Dorn under the MIT license.