laravel-smarty maintained by ytake
- php ^8.1
- illuminate/support ^10.0|^11.0
- illuminate/view ^10.0|^11.0
- illuminate/config ^10.0|^11.0
- illuminate/console ^10.0|^11.0
- illuminate/events ^10.0|^11.0
- smarty/smarty ^4.3
- php ^8.1
- illuminate/support ^10.0|^11.0
- illuminate/view ^10.0|^11.0
- illuminate/config ^10.0|^11.0
- illuminate/console ^10.0|^11.0
- illuminate/events ^10.0|^11.0
- smarty/smarty ^4.3
- php ^8.1
- illuminate/support ^10.0
- illuminate/view ^10.0
- illuminate/config ^10.0
- illuminate/console ^10.0
- illuminate/events ^10.0
- smarty/smarty ^4.3
- php ^8.1
- illuminate/support ^10.0
- illuminate/view ^10.0
- illuminate/config ^10.0
- illuminate/console ^10.0
- illuminate/events ^10.0
- smarty/smarty ^4.3
- php ^8.0.2
- illuminate/support ^9.0
- illuminate/view ^9.0
- illuminate/config ^9.0
- illuminate/console ^9.0
- illuminate/events ^9.0
- smarty/smarty ^4.1.0
- php ^7.3 | ^8.0
- illuminate/support ^8.0
- illuminate/view ^8.0
- illuminate/config ^8.0
- illuminate/console ^8.0
- illuminate/events ^8.0
- smarty/smarty ^3.1.33
- php ^7.3
- illuminate/support ^8.0
- illuminate/view ^8.0
- illuminate/config ^8.0
- illuminate/console ^8.0
- illuminate/events ^8.0
- smarty/smarty ^3.1.33
- php >=7.2
- illuminate/support ^6.0|^7.0
- illuminate/view ^6.0|^7.0
- illuminate/config ^6.0|^7.0
- illuminate/console ^6.0|^7.0
- illuminate/events ^6.0|^7.0
- smarty/smarty ^3.1.33
- smarty/smarty ^3.1.33
- php >=7.2
- illuminate/support ^6.0|^7.0
- illuminate/view ^6.0|^7.0
- illuminate/config ^6.0|^7.0
- illuminate/console ^6.0|^7.0
- illuminate/events ^6.0|^7.0
- php >=7.0.0
- illuminate/support ^5.5|^6.0
- illuminate/view ^5.5|^6.0
- illuminate/config ^5.5|^6.0
- illuminate/console ^5.5|^6.0
- illuminate/events ^5.5|^6.0
- smarty/smarty ^3.1.33
- php >=7.0.0
- illuminate/support ^5.5|^6.0
- illuminate/view ^5.5|^6.0
- illuminate/config ^5.5|^6.0
- illuminate/console ^5.5|^6.0
- illuminate/events ^5.5|^6.0
- smarty/smarty ^3.1.33
- php >=7.0.0
- illuminate/support ^5.5|^6.0
- illuminate/view ^5.5|^6.0
- illuminate/config ^5.5|^6.0
- illuminate/console ^5.5|^6.0
- illuminate/events ^5.5|^6.0
- smarty/smarty ^3.1.33
- php >=7.0.0
- illuminate/support 5.5.*|5.6.*|5.7.*|5.8.*
- illuminate/view 5.5.*|5.6.*|5.7.*|5.8.*
- illuminate/config 5.5.*|5.6.*|5.7.*|5.8.*
- illuminate/console 5.5.*|5.6.*|5.7.*|5.8.*
- illuminate/events 5.5.*|5.6.*|5.7.*|5.8.*
- smarty/smarty ^3.1.31
- php >=7.0.0
- illuminate/support 5.5.*|5.6.*|5.7.*
- illuminate/view 5.5.*|5.6.*|5.7.*
- illuminate/config 5.5.*|5.6.*|5.7.*
- illuminate/console 5.5.*|5.6.*|5.7.*
- illuminate/events 5.5.*|5.6.*|5.7.*
- smarty/smarty ^3.1.31
- php >=7.0.0
- illuminate/support 5.5.*|5.6.*
- illuminate/view 5.5.*|5.6.*
- illuminate/config 5.5.*|5.6.*
- illuminate/console 5.5.*|5.6.*
- illuminate/events 5.5.*|5.6.*
- smarty/smarty ^3.1.31
- php >=7.0.0
- illuminate/support ^5.5
- illuminate/view ^5.5
- illuminate/config ^5.5
- illuminate/console ^5.5
- illuminate/events ^5.5
- smarty/smarty ^3.1.31
- php >=7.0.0
- illuminate/support ^5.5
- illuminate/view ^5.5
- illuminate/config ^5.5
- illuminate/console ^5.5
- illuminate/events ^5.5
- smarty/smarty ^3.1.31
- php >=5.5.9
- illuminate/support ~5.0
- illuminate/view ~5.0
- illuminate/config ~5.0
- illuminate/console ~5.0
- illuminate/events ~5.0
- smarty/smarty ~3.1.30
- php >=5.5.9
- illuminate/support ~5.0
- illuminate/view ~5.0
- illuminate/config ~5.0
- illuminate/console ~5.0
- illuminate/events ~5.0
- smarty/smarty ~3.1.30
- php >=5.4.0
- illuminate/support ~5.0
- illuminate/view ~5.0
- illuminate/config ~5.0
- illuminate/console ~5.0
- illuminate/events ~5.0
- smarty/smarty ~3.0
- php >=5.4.0
- illuminate/support ~5.0
- illuminate/view ~5.0
- illuminate/config ~5.0
- illuminate/console ~5.0
- illuminate/events ~5.0
- smarty/smarty ~3.0
- php >=5.4.0
- illuminate/support ~5.0
- illuminate/view ~5.0
- illuminate/config ~5.0
- illuminate/console ~5.0
- illuminate/events ~5.0
- smarty/smarty ~3.0
- php >=5.4.0
- illuminate/support ~5.0
- illuminate/view ~5.0
- illuminate/config ~5.0
- illuminate/console ~5.0
- illuminate/events ~5.0
- smarty/smarty ~3.0
- php >=5.4.0
- illuminate/support ~5.0
- illuminate/view ~5.0
- illuminate/config ~5.0
- illuminate/console ~5.0
- illuminate/events ~5.0
- smarty/smarty ~3.0
- php >=5.4.0
- illuminate/support ~5.0
- illuminate/view ~5.0
- illuminate/config ~5.0
- illuminate/console ~5.0
- illuminate/events ~5.0
- smarty/smarty ~3.0
- vlucas/phpdotenv ~1.0
- php >=5.4.0
- illuminate/support 5.*
- illuminate/view 5.*
- illuminate/config 5.*
- illuminate/console 5.*
- illuminate/events 5.*
- smarty/smarty 3.*
- vlucas/phpdotenv ~1.0
- php >=5.4.0
- illuminate/support 5.*
- illuminate/view 5.*
- illuminate/config 5.*
- illuminate/console 5.*
- illuminate/events 5.*
- smarty/smarty 3.*
- vlucas/phpdotenv ~1.0
- php >=5.4.0
- illuminate/support 5.*
- illuminate/view 5.*
- illuminate/config 5.*
- illuminate/console 5.*
- illuminate/events 5.*
- smarty/smarty 3.*
- vlucas/phpdotenv ~1.0
- php >=5.4.0
- illuminate/support 5.*
- illuminate/view 5.*
- illuminate/config 5.*
- illuminate/console 5.*
- illuminate/events 5.*
- smarty/smarty 3.*
- php >=5.4.0
- illuminate/support 5.*
- illuminate/view 5.*
- illuminate/config 5.*
- illuminate/console 5.*
- illuminate/events 5.*
- smarty/smarty 3.*@stable
- php >=5.4.0
- smarty/smarty 3.*@stable
- illuminate/support 5.0.*
- illuminate/view 5.0.*
- illuminate/config 5.0.*
- illuminate/console 5.0.*
- illuminate/events 5.0.*
- php >=5.4.0
- illuminate/support 5.0.*
- illuminate/view 5.0.*
- illuminate/config 5.0.*
- illuminate/console 5.0.*
- illuminate/events 5.0.*
- smarty/smarty 3.*@stable
- php >=5.4.0
- illuminate/support 5.*
- illuminate/view 5.*
- illuminate/config 5.*
- illuminate/console 5.*
- illuminate/events 5.*
- smarty/smarty 3.*@stable
- php >=5.4.0
- illuminate/support 5.*
- illuminate/view 5.*
- illuminate/config 5.*
- illuminate/console 5.*
- illuminate/events 5.*
- smarty/smarty 3.*@stable
- php >=5.4.0
- illuminate/support 5.*
- illuminate/view 5.*
- illuminate/config 5.*
- illuminate/console 5.*
- illuminate/events 5.*
- smarty/smarty 3.*@stable
- php >=5.4.0
- illuminate/support 4.2.*
- illuminate/view 4.2.*
- illuminate/config 4.2.*
- illuminate/console 4.2.*
- smarty/smarty 3.*@stable
- php >=5.4.0
- illuminate/support 4.2.*
- illuminate/view 4.2.*
- illuminate/config 4.2.*
- illuminate/console 4.2.*
- smarty/smarty 3.*@stable
- php >=5.3.7
- illuminate/support 4.1.*
- illuminate/view 4.1.*
- illuminate/config 4.1.*
- illuminate/console 4.1.*
- illuminate/html 4.1.*
- smarty/smarty 3.*@stable
- php >=5.3.7
- illuminate/support 4.1.*
- illuminate/view 4.1.*
- illuminate/config 4.1.*
- illuminate/console 4.1.*
- illuminate/html 4.1.*
- smarty/smarty 3.*@stable
- php >=5.3.7
- illuminate/support 4.1.*
- illuminate/view 4.1.*
- illuminate/config 4.1.*
- illuminate/console 4.1.*
- illuminate/html 4.1.*
- smarty/smarty 3.*@stable
- php >=5.3.7
- illuminate/support 4.1.*
- illuminate/view 4.1.*
- illuminate/config 4.1.*
- illuminate/console 4.1.*
- illuminate/html 4.1.*
- smarty/smarty 3.*
- php >=5.4.0
- illuminate/support 4.2.*
- illuminate/view 4.2.*
- illuminate/config 4.2.*
- illuminate/console 4.2.*
- illuminate/html 4.2.*
- smarty/smarty 3.*
Laravel.Smarty
Smarty Template Engine for Laravel
(Support for Laravel5.x - Laravel8.x and Lumen)
Installation For Laravel
Require this package with Composer
$ composer require ytake/laravel-smarty
or composer.json
"require": {
"ytake/laravel-smarty": "^6.0"
},
Supported Auto-Discovery(^Laravel5.5)
add Laravel.Smarty Service Providers
your config/app.php
'providers' => [
// add smarty extension
Ytake\LaravelSmarty\SmartyServiceProvider::class,
// add artisan commands
Ytake\LaravelSmarty\SmartyConsoleServiceProvider::class,
]
Installation For Lumen
Require this package with Composer
$ composer require ytake/laravel-smarty
or composer.json
"require": {
"ytake/laravel-smarty": "~2.0"
},
register Laravel.Smarty Service Providers
your bootstrap/app.php
$app->configure('ytake-laravel-smarty');
$app->register(Ytake\LaravelSmarty\SmartyServiceProvider::class);
$app->register(Ytake\LaravelSmarty\SmartyConsoleServiceProvider::class);
Configuration
publish configuration file (for Laravel5)
$ php artisan vendor:publish
publish to config directory
Of Course, Blade Template can also be used to Render Engine.
configuration file (for Lumen)
Copy the vendor/ytake/laravel-smarty/src/config/ytake-laravel-smarty.php file to your local config directory
config for Production
edit config/ytake-laravel-smarty.php
// enabled smarty template cache
'caching' => true, // default false
// disabled smarty template compile
'force_compile' => false, // default true(for develop)
Or
add .env file
SMARTY_CACHE=true
SMARTY_COMPILE=false
edit config/ytake-laravel-smarty.php
'caching' => env('SMARTY_CACHING', false),
'force_compile' => env('SMARTY_FORCE_COMPILE', true),
and more..!
Basic
easily use all the methods of Smarty
// laravel5 view render
view("template.name");
// Laravel blade template render(use Facades)
\View::make('template', ['hello']);
// use Smarty method
\View::assign('word', 'hello');
\View::clearAllAssign(); // smarty method
View Composer, and View Share
$this->app['view']->composer('index', function (View $view) {
$view->with('message', 'enable smarty');
});
$this->app['view']->share('title', 'laravel-smarty');
Hello Laravel.Smarty
{$title}
{$message}
Artisan
smarty's cache clear, remove compile class from Artisan(cli)
Template cache clear
$ php artisan ytake:smarty-clear-cache
| Options | description |
|---|---|
| --file (-f) | specify file |
| --time (-t) | clear all of the files that are specified duration time |
| --cache_id (-cache) | specified cache_id groups |
Remove compile file
$ php artisan ytake:smarty-clear-compiled
| Options | description |
|---|---|
| --file (-f) | specify file |
| --compile_id (-compile) | specified compile_id |
Template Compiler
$ php artisan ytake:smarty-optimize
| Options | description |
|---|---|
| --extension (-e) | specified smarty file extension(default: .tpl) |
| --force | compiles template files found in views directory |
Template Caching
choose file, memcached, Redis
(default file cache driver)
// smarty cache driver "file", "memcached", "redis"
'cache_driver' => 'file',
// memcached servers
'memcached' => [
[
'host' => '127.0.0.1',
'port' => 11211,
'weight' => 100
],
],
// redis configure
'redis' => [
[
'host' => '127.0.0.1',
'port' => 6379,
'database' => 0,
],
],
example
registerFilter in ServiceProvider
registerFilter in Controller
layout.sample
layout.extends.sample