wcadena / laravel-string-blade-compiler
将字符串渲染为Blade模板
1.3.2
2019-01-08 17:01 UTC
Requires
- php: >=7
README
最初是从Flynsarmy/laravel-db-blade-compiler分叉而来,并最初是从bilaliqbalr/laravel-string-blade-compiler分叉而来
将字符串渲染为Blade模板
此包从提供的字符串生成并返回编译后的视图
安装(Laravel 5.4.x)
在您的composer.json中需要此包并运行composer update(或直接运行composer require wcadena/string-blade-compiler:1.*
)
"wcadena/laravel-string-blade-compiler": "1.*"
更新composer后,将ServiceProvider添加到app/config/app.php中的providers数组中
Wcadena\StringBladeCompiler\StringBladeCompilerServiceProvider::class,
并在同一文件中将Facade添加到aliases数组中
'StringView' => Wcadena\StringBladeCompiler\Facades\StringView::class,
您还需要发布配置文件
php artisan vendor:publish
用法
此包提供了一个具有与View
相同语法的StringView
外观,但接受字符串而不是视图路径。
return StringView::make('@if ($foo == "Bar") foo is Bar @else foo is not Bar @endif')->with(['foo' => 'Bar'])->render();
许可证
string-blade-compiler是开源软件,许可协议为MIT许可