PHPackages                             linushstge/laravel-smarty - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. linushstge/laravel-smarty

ActiveLibrary[Templating &amp; Views](/categories/templating)

linushstge/laravel-smarty
=========================

Smarty template engine for Laravel and Lumen

9.0.0(11mo ago)13.6k↓25%MITPHPPHP ^8.3

Since Jul 21Pushed 11mo agoCompare

[ Source](https://github.com/linushstge/laravel.smarty)[ Packagist](https://packagist.org/packages/linushstge/laravel-smarty)[ RSS](/packages/linushstge-laravel-smarty/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (18)Versions (3)Used By (0)

Laravel.Smarty
==============

[](#laravelsmarty)

Smarty Template Engine for Laravel
(Support for Laravel5.x - Laravel8.x and Lumen)

[![Build Status](https://camo.githubusercontent.com/702700136f1d012a886b1601ad4a1d2b69cadcc670e174b8f22aa7fa5efc10d9/687474703a2f2f696d672e736869656c64732e696f2f7472617669732f7974616b652f4c61726176656c2e536d617274792f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/ytake/Laravel.Smarty)[![Coverage Status](https://camo.githubusercontent.com/9a70e9390ec0c597168f1e847ce880399088473f6b784add45d677ccde67a7a9/687474703a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f7974616b652f4c61726176656c2e536d617274792f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/r/ytake/Laravel.Smarty?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6508a9cba8d867c621863abd13783f679da13bff91df0d5ad47f45a38ccb3548/687474703a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7974616b652f4c61726176656c2e536d617274792e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/ytake/Laravel.Smarty/?branch=master)

[![License](https://camo.githubusercontent.com/d61c3b6249d94c86ec8f2f4edfdd236e38fda3f7c8a2d46cf79dda6c920d1688/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7974616b652f6c61726176656c2d736d617274792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ytake/laravel-smarty)[![Latest Version](https://camo.githubusercontent.com/7798a014a1f5d580c5dbf57527f459e1343b5f195269923da4befc084f3202f4/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7974616b652f6c61726176656c2d736d617274792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ytake/laravel-smarty)[![Total Downloads](https://camo.githubusercontent.com/269b9857fef7b45c7cc354f96f1ce87924f0822ab1a44f5cada8138248f725f0/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7974616b652f6c61726176656c2d736d617274792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ytake/laravel-smarty)

Installation For Laravel
------------------------

[](#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
----------------------

[](#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
-------------

[](#configuration)

### publish configuration file (for Laravel5)

[](#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)

[](#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

[](#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
-----

[](#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
-----------------------------

[](#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
-------

[](#artisan)

smarty's cache clear, remove compile class from Artisan(cli)

### Template cache clear

[](#template-cache-clear)

```
$ php artisan ytake:smarty-clear-cache
```

Optionsdescription--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

[](#remove-compile-file)

```
$ php artisan ytake:smarty-clear-compiled
```

Optionsdescription--file (-f)specify file--compile\_id (-compile)specified compile\_id### Template Compiler

[](#template-compiler)

```
$ php artisan ytake:smarty-optimize
```

Optionsdescription--extension (-e)specified smarty file extension(default: *.tpl*)--forcecompiles template files found in views directoryTemplate Caching
----------------

[](#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

[](#example)

[registerFilter in ServiceProvider](https://gist.github.com/ytake/e8c834e88473ea3f10e7)
[registerFilter in Controller](https://gist.github.com/ytake/1a6f1d5312b552bc83ff)
[layout.sample](https://gist.github.com/ytake/11345539)
[layout.extends.sample](https://gist.github.com/ytake/11345614)

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance51

Moderate activity, may be stable

Popularity24

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 82.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

347d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f25040deb8966315d3ffd19660e76fe4aa30fad908e5c468db6167a515bcfe6?d=identicon)[linushstge](/maintainers/linushstge)

---

Top Contributors

[![ytake](https://avatars.githubusercontent.com/u/4454078?v=4)](https://github.com/ytake "ytake (165 commits)")[![JayBizzle](https://avatars.githubusercontent.com/u/340752?v=4)](https://github.com/JayBizzle "JayBizzle (15 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (5 commits)")[![linushstge](https://avatars.githubusercontent.com/u/2674751?v=4)](https://github.com/linushstge "linushstge (5 commits)")[![m-bymike](https://avatars.githubusercontent.com/u/4008663?v=4)](https://github.com/m-bymike "m-bymike (2 commits)")[![kevincobain2000](https://avatars.githubusercontent.com/u/629055?v=4)](https://github.com/kevincobain2000 "kevincobain2000 (2 commits)")[![DariusIII](https://avatars.githubusercontent.com/u/3399658?v=4)](https://github.com/DariusIII "DariusIII (2 commits)")[![coderua](https://avatars.githubusercontent.com/u/1074951?v=4)](https://github.com/coderua "coderua (1 commits)")[![unstoppablecarl](https://avatars.githubusercontent.com/u/913047?v=4)](https://github.com/unstoppablecarl "unstoppablecarl (1 commits)")[![eschalks](https://avatars.githubusercontent.com/u/470429?v=4)](https://github.com/eschalks "eschalks (1 commits)")[![cabloo](https://avatars.githubusercontent.com/u/229041?v=4)](https://github.com/cabloo "cabloo (1 commits)")[![likemusic](https://avatars.githubusercontent.com/u/603401?v=4)](https://github.com/likemusic "likemusic (1 commits)")

---

Tags

laravellumencachetemplateviewsmarty

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/linushstge-laravel-smarty/health.svg)

```
[![Health](https://phpackages.com/badges/linushstge-laravel-smarty/health.svg)](https://phpackages.com/packages/linushstge-laravel-smarty)
```

###  Alternatives

[ytake/laravel-smarty

Smarty template engine for Laravel and Lumen

87401.6k](/packages/ytake-laravel-smarty)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[jenssegers/blade

The standalone version of Laravel's Blade templating engine for use outside of Laravel.

8661.2M109](/packages/jenssegers-blade)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[leitsch/kirby-blade

Enable Laravel Blade Template Engine for Kirby 4 and Kirby 5

219.2k](/packages/leitsch-kirby-blade)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
