Looking to hire Laravel developers? Try LaraJobs

laravel-render-blade-string maintained by felixdorn

Description
A function that can render Blade on the fly.
Author
Last update
2022/02/11 13:53 (dev-master)
License
Links
Downloads
1 409

Comments
comments powered by Disqus

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.

Tests Formats Version Total Downloads License

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.