Laravel Smarty¶
Replace Blade with Smarty 5 as the default view engine in a
Laravel application — view('welcome') renders welcome.tpl, with Blade still available
as a fallback for any view that doesn't have a Smarty template.
Highlights¶
- Drop-in: registers ahead of Blade on the view finder; both engines coexist.
- Safe by default:
{$var}output is HTML-escaped, and the built-in plugins escape user-coupled output the way Blade's directives do. - Blade-parity plugins:
{auth},{can},{feature},{env},{old},{checked},{route},{vite},|trans,|currency, and friends. - Caching-correct: with Smarty's output cache on, everything request- or locale-coupled re-evaluates per render instead of being baked in.
- Sandboxable: two shipped security policies for admin-authored and user-submitted templates.
- Laravel-native errors: exceptions map back to the
.tplsource line, view composers and Debugbar see every sub-template.
Where to go¶
| New here? | Overview → Quick start |
| Setting up | Configuration, Artisan commands |
| Writing templates | Built-in plugins, Wrapper objects, Pagination |
| Extending | Custom plugins |
| Locking down | Security policy |
| Something's off | Troubleshooting |
| Contributing | Development |
Requirements¶
PHP ^8.1 · Laravel 10 / 11 / 12 / 13 · smarty/smarty ^5.4