addons / smarty
此包让您的Laravel优雅地运行Smarty4。
1.0.5
2022-02-23 04:34 UTC
Requires
- php: >=7.4.0
- illuminate/cache: >=8.0
- illuminate/config: >=8.0
- illuminate/support: >=8.0
- smarty/smarty: 4.*@stable
README
此包让您的Laravel5优雅地运行Smarty3。
安装
composer require addons/smarty dev-master
使用composer update
更新包或使用composer install
安装。
使用方法
要使用Smarty服务提供者,您必须在启动您的Laravel应用程序时注册该提供者。实际上有两种方法可以做到这一点。
在config/app.php
中找到providers
键并注册Smarty服务提供者。
'providers' => [ // ... 'Addons\Smarty\View\SmartyServiceProvider', ]
然后使用php artisan vendor:publish
发布配置文件。这将添加config/smarty.php
文件。此配置文件是您与Smarty交互的主要方式。
然后只需使用Laravel的正常点符号语法引用模板。
例如,要加载smarty模板views/blog/post.tpl
,您将使用view('blog.post')
。
在Smarty的{include}
或{extends}
标签中,您应该继续使用完整的目录语法,例如{extends file="blog/post.tpl"}
。