LaravelPackages.net
Acme Inc.
Toggle sidebar
wcadena/laravel-string-blade-compiler

Render Blade templates from a string

512
0
1.3.2
About wcadena/laravel-string-blade-compiler

wcadena/laravel-string-blade-compiler is a Laravel package for render blade templates from a string. It currently has 0 GitHub stars and 512 downloads on Packagist (latest version 1.3.2). Install it with composer require wcadena/laravel-string-blade-compiler. Discover more Laravel packages by wcadena or browse all Laravel packages to compare alternatives.

Last updated

String Blade Compiler (Laravel 5.8)

Originally forked from Flynsarmy/laravel-db-blade-compiler y Originally forked from bilaliqbalr/laravel-string-blade-compiler

Render Blade templates from a string

This package generates and returns a compiled view from a provided string

Installation (Laravel 5.4.x)

Require this package in your composer.json and run composer update (or run composer require wcadena/string-blade-compiler:1.* directly):

"wcadena/laravel-string-blade-compiler": "1.*"

After updating composer, add the ServiceProvider to the providers array in app/config/app.php

Wcadena\StringBladeCompiler\StringBladeCompilerServiceProvider::class,

and the Facade to the aliases array in the same file

'StringView'          => Wcadena\StringBladeCompiler\Facades\StringView::class,

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

string-blade-compiler is open-sourced software licensed under the MIT license

Star History Chart