digivo / laravel-string-blade-compiler
Render Blade templates from a string
Installs: 14 905
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 8
Open Issues: 1
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-11-23 20:20:39 UTC
README
Originally forked from Flynsarmy/laravel-db-blade-compiler
Render Blade templates from a string
This package generates and returns a compiled view from a provided string
Installation (Laravel 5.x)
Require this package in your composer.json and run composer update (or run composer require digivo/laravel-string-blade-compiler:1.*
directly):
"digivo/laravel-string-blade-compiler": "1.*"
After updating composer, add the ServiceProvider to the providers array in app/config/app.php
'Digivo\StringBladeCompiler\StringBladeCompilerServiceProvider',
and the Facade to the aliases array in the same file
'StringView' => 'Digivo\StringBladeCompiler\Facades\DigivoView',
You have to also publish the config-file
php artisan vendor:publish
Usage
This package offers a StringView
facade with the same syntax as View
but accepts a string instead of path to view.
return StringView::make('@if ($foo == "Bar") foo is Bar @else foo is not Bar @endif')->with(['foo' => 'Bar'])->render();
License
laravel-string-blade-compiler is open-sourced software licensed under the MIT license