PHPackages                             ytake/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. ytake/laravel-smarty

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

ytake/laravel-smarty
====================

Smarty template engine for Laravel and Lumen

8.0.0(2y ago)87401.6k↓32.3%22[4 issues](https://github.com/ytake/Laravel.Smarty/issues)[1 PRs](https://github.com/ytake/Laravel.Smarty/pulls)MITPHPPHP ^8.1CI passing

Since Sep 19Pushed 1y ago7 watchersCompare

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

READMEChangelog (10)Dependencies (18)Versions (42)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

52

—

FairBetter than 96% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity50

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity84

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 83.3% 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

Every ~101 days

Recently: every ~233 days

Total

35

Last Release

805d ago

Major Versions

3.0.1 → 4.0.02020-03-19

4.0.0 → 5.0.02020-10-27

5.1.0 → 6.0.02022-02-11

6.0.0 → 7.0.02023-03-15

7.0.1 → 8.0.02024-03-04

PHP version history (9 changes)1.2.0PHP &gt;=5.4.0

1.1.0PHP &gt;=5.3.7

2.1.11PHP &gt;=5.5.9

2.2.0PHP &gt;=7.0.0

4.0.0PHP &gt;=7.2

5.0.0PHP ^7.3

5.1.0PHP ^7.3 | ^8.0

6.0.0PHP ^8.0.2

7.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/47817f3dd2890864096bd77ee772ec46061432f128988ca23939b0ca486d7bc3?d=identicon)[ytake](/maintainers/ytake)

---

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 (2 commits)")[![m-bymike](https://avatars.githubusercontent.com/u/4008663?v=4)](https://github.com/m-bymike "m-bymike (2 commits)")[![DariusIII](https://avatars.githubusercontent.com/u/3399658?v=4)](https://github.com/DariusIII "DariusIII (2 commits)")[![kevincobain2000](https://avatars.githubusercontent.com/u/629055?v=4)](https://github.com/kevincobain2000 "kevincobain2000 (2 commits)")[![eschalks](https://avatars.githubusercontent.com/u/470429?v=4)](https://github.com/eschalks "eschalks (1 commits)")[![coderua](https://avatars.githubusercontent.com/u/1074951?v=4)](https://github.com/coderua "coderua (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)")[![unstoppablecarl](https://avatars.githubusercontent.com/u/913047?v=4)](https://github.com/unstoppablecarl "unstoppablecarl (1 commits)")

---

Tags

laravellumensmartytemplatelaravellumencachetemplateviewsmarty

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[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)[latrell/smarty

This package lets you run Smarty3 on Laravel5 elegantly.

127.0k](/packages/latrell-smarty)

PHPackages © 2026

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