laravel-smarty maintained by vusys
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
- php ^8.1
- illuminate/contracts ^10.0|^11.0|^12.0|^13.0
- illuminate/support ^10.0|^11.0|^12.0|^13.0
- illuminate/view ^10.0|^11.0|^12.0|^13.0
- smarty/smarty ^5.4
vusys/laravel-smarty
Replace Blade with Smarty 5 as the default view engine in a Laravel application.
📚 Full documentation: vusys.github.io/laravel-smarty
Requirements
- PHP
^8.1 - Laravel
^10 | ^11 | ^12 | ^13 smarty/smarty^5.4
Installation
composer require vusys/laravel-smarty
The service provider is registered automatically via package discovery.
Publish the config (optional):
php artisan vendor:publish --tag=smarty-config
That writes config/smarty.php.
To customise the bundled paginator templates, publish them with:
php artisan vendor:publish --tag=smarty-pagination-views
That copies the pagination::* presets (Tailwind, Bootstrap 3/4/5, Semantic UI, and their simple variants) into resources/views/vendor/pagination/, where your edits override both the package's bundled .tpl and Laravel's framework Blade views. See docs/pagination.md for details.
Quick start
Create resources/views/welcome.tpl:
<!doctype html>
<html lang="en">
<head><title>{$title}</title></head>
<body>
<h1>Hello, {$name}!</h1>
</body>
</html>
{$var} output is HTML-escaped automatically (escape_html is on by default), matching Blade's {{ }} — no |escape needed. Use {$var nofilter} where you deliberately want raw output.
Render it like any Laravel view:
Route::get('/', fn () => view('welcome', [
'title' => 'Home',
'name' => 'World',
]));
Smarty resolves before Blade, so a welcome.tpl overrides an existing welcome.blade.php for the same view name.
Documentation
| Topic | What's in it |
|---|---|
| Overview | Why this package exists; how the Smarty bridge plugs into Laravel's view machinery. |
| Quick start | First template, route, and a {extends} inheritance example. |
| Configuration | Every config/smarty.php key, plus the SmartyFactory::configure() hook for advanced wiring. |
| Security policy | The shipped Balanced / Strict policies and when to use each. |
| Built-in plugins | {auth}, {can}, {feature}, {route}, {lang}, {vite}, number modifiers, and the rest. |
| Auto-shared wrapper objects | $auth, $request, $session, $route, $errors and their reserved-key behaviour. |
| Pagination | Bundled paginator presets and how to publish them. |
| Custom plugins | File-based plugins, class-backed discovery, and the discovery cache. |
| Artisan commands | smarty:optimize, the clear-* commands, and the plugin discovery cache commands. |
| Laravel integration | View composers, Debugbar/Telescope, and .tpl source-line error mapping. |
| Troubleshooting | Stale compiles after deploys, ReservedTemplateVariable, escaping surprises, Octane notes. |
| Development | Running tests, static analysis, code style. |
License
MIT.