PHPackages                             vi-kon/laravel-smarty-view - 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. vi-kon/laravel-smarty-view

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

vi-kon/laravel-smarty-view
==========================

Smarty template engine for Laravel 4

v1.0.17(11y ago)2851MITPHPPHP &gt;=5.4.0

Since May 23Pushed 11y ago1 watchersCompare

[ Source](https://github.com/vi-kon/laravel-smarty-view)[ Packagist](https://packagist.org/packages/vi-kon/laravel-smarty-view)[ Docs](https://github.com/vi-kon/laravel-smarty-view)[ RSS](/packages/vi-kon-laravel-smarty-view/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (2)Versions (22)Used By (0)

Laravel 4 Smarty view
=====================

[](#laravel-4-smarty-view)

Smarty template engine for Laravel 4

Table of content
----------------

[](#table-of-content)

- [Known issues](#known-issues)
- [TODO](#todo)
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [Config files](#config-files)
- [Events](#events)
    - [smarty-view.init](#smarty-view.init)
- [Custom plugins](#custom-plugins)
    - [auth\_check](#auth-check)
    - [auth\_user](#auth-user)
    - [config](#config)
    - [datatable](#datatable)
    - [datatable\_column](#datatable-column)
    - [form](#form)
    - [form\_checkbox](#form-checkbox)
    - [form\_file](#form-file)
    - [form\_hidden](#form-hidden)
    - [form\_label](#form-label)
    - [form\_password](#form-password)
    - [form\_radio](#form-radio)
    - [form\_select](#form-select)
    - [form\_submit](#form-submit)
    - [form\_text](#form-text)
    - [form\_textarea](#form-textarea)
    - [html\_script](#html-script)
    - [lang](#lang)
    - [url](#url)
    - [url\_current](#url-current)
    - [url\_full](#url-full)
- [License](#license)

Known issues
------------

[](#known-issues)

- none

---

[Back to top](#laravel-4-smarty-view)

TODO
----

[](#todo)

- Fix incoming bugs
- Finish documentation

---

[Back to top](#laravel-4-smarty-view)

Features
--------

[](#features)

- using smarty templates
- using multiple template engines

---

[Back to top](#laravel-4-smarty-view)

Installation
------------

[](#installation)

To your `composer.json` file add following lines:

```
// to your "require" object
"vi-kon/laravel-smarty-view": "1.*"
```

In your Laravel 4 project add following lines to `app.php`:

```
// to your providers array
'ViKon\SmartyView\SmartyViewServiceProvider',
```

---

[Back to top](#laravel-4-smarty-view)

Usage
-----

[](#usage)

Simply create new template file with `.tpl` extension and load with `View` class.

```
\View::make('route/to/template/file')
     ->with("param", null);
```

On extending or loading another smarty template need path prefix with `view:path`.

```
{extends file="view:layout-site"}
...
```

---

[Back to top](#laravel-4-smarty-view)

Config file
-----------

[](#config-file)

On custom config easily publish it with `php artisan config:publish vi-kon/laravel-smarty-view` command. The command will create new file `app/config/packages/vi-kon/laravel-smarty-view/config.php`. The file need to move to `app/config/packages/vi-kon/smarty-view/config.php` location.

`config.php` content:

```
return array(
    // Enable or disable caching
    'caching'         => false,
    // Enable or disable debugging
    'debugging'       => false,
    // Set cache lifetime
    'cache_lifetime'  => 3600,
    // Check compile
    'compile_check'   => true,
    // Set error reporting level in Smarty templates
    'error_reporting' => null,

    // Template directory
    'template_dir'    => app_path() . '/views',
    // Cache directory
    'cache_dir'       => app_path() . '/storage/views/cache',
    // Compile directory
    'compile_dir'     => app_path() . '/storage/views/compile',

    // Plugins directory
    'plugins_path'    => array(),
);
```

---

[Back to top](#laravel-4-smarty-view)

Events
------

[](#events)

- [smarty-view.init](#smarty-view.init)

---

[Back to top](#laravel-4-smarty-view)

### smarty-view.init

[](#smarty-viewinit)

Firring, when SmartyView is constructed, to add custom configuration options.

#### Attributes

[](#attributes)

TypeNameDescription`Illuminate\Config\Repository``options`Is alias for `\Config` object#### Usage

[](#usage-1)

Example usage in package service provider:

```
public function boot()
    \Event::listen('smarty-view.init', function ($config)
    {
        $config->set('smarty-view::plugins_path', array_merge(
            $config->get('smarty-view::plugins_path'),
            array(__DIR__ . DIRECTORY_SEPARATOR . 'smarty' . DIRECTORY_SEPARATOR . 'plugins')));
    });
}
```

---

[Back to top](#laravel-4-smarty-view)

Custom plugins
--------------

[](#custom-plugins)

Avalaible custom plugins:

- [auth\_check](#auth-check)
- [auth\_user](#auth-user)
- [config](#config)
- [datatable](#datatable)
- [datatable\_column](#datatable-column)
- [form](#form)
- [form\_checkbox](#form-checkbox)
- [form\_file](#form-file)
- [form\_hidden](#form-hidden)
- [form\_label](#form-label)
- [form\_password](#form-password)
- [form\_radio](#form-radio)
- [form\_select](#form-select)
- [form\_submit](#form-submit)
- [form\_text](#form-text)
- [form\_textarea](#form-textarea)
- [html\_script](#html-script)
- [lang](#lang)
- [url](#url)
- [url\_current](#url-current)
- [url\_full](#url-full)

### Auth check

[](#auth-check)

The **auth\_check** tag is alias for:

```
return Auth::check();
```

---

[Back to top](#laravel-4-smarty-view)

Return value is type of `boolean`.

### Auth user

[](#auth-user)

The **auth\_user** tag is alias for (if no `assign` attribute provided):

```
return Auth::getUser();
```

Return value is type of `UserInterface` or `null`.

#### Attributes

[](#attributes-1)

TypeNameDescriptionRequiredDefaultstring`assign`Assign user data to named variable instead return-----

[Back to top](#laravel-4-smarty-view)

### Config

[](#config)

The **config** tag is alias for:

```
return Config::get($key, $default);
```

Return value is type of `mixed`.

#### Attributes

[](#attributes-2)

TypeNameDescriptionRequiredDefaultstring`key`Config variable keyx-mixed`default`Default value if config key not exists--#### Usage

[](#usage-2)

```
{config key="app.locale"}
```

---

[Back to top](#laravel-4-smarty-view)

### Datatable

[](#datatable)

The **datatable** block tag is for [chumper/datatable](https://github.com/Chumper/Datatable) Laravel 4 package to make datatables.

Plugin can load localization (language) data from `lang\{local}\datatable.php`. If language file not exists datatables default localization data will be used.

#### Attributes

[](#attributes-3)

TypeNameDescriptionRequiredDefaultstring`url`Full URL for AJAX data--string`action`Route name for AJAX data--boolean`searching`Enable or disable searching-`true`boolean`lengthChange`--string`class`Add custom class to datatable--string`view`Custom view to render datatable-`"datatable"`#### Usage

[](#usage-3)

```
{datatable action="route name" class="table-own" searching=false lengthChange=false}

...

{/datatable}
```

Sample **datatable.php** language file:

```
return array(
    'sEmptyTable'     => 'No data available in table',
    'sInfo'           => 'Showing _START_ to _END_ of _TOTAL_ entries',
    'sInfoEmpty'      => 'Showing 0 to 0 of 0 entries',
    'sInfoFiltered'   => '(filtered from _MAX_ total entries)',
    'sInfoPostFix'    => '',
    'sInfoThousands'  => ',',
    'sLengthMenu'     => 'Show _MENU_ entries',
    'sLoadingRecords' => 'Loading...',
    'sProcessing'     => 'Processing...',
    'sSearch'         => 'Search:',
    'sZeroRecords'    => 'No matching records found',
    'oPaginate'       => array(
        'sFirst'    => 'First',
        'sLast'     => 'Last',
        'sNext'     => 'Next',
        'sPrevious' => 'Previous',
    ),
    'oAria'           => array(
        'sSortAscending'  => '=> activate to sort column ascending',
        'sSortDescending' => '=> activate to sort column descending',
    ),
);
```

---

[Back to top](#laravel-4-smarty-view)

### Datatable column

[](#datatable-column)

Add column to Datatable. Have to declared in `{datatable}` block, otherwise it won't work.

#### Attributes

[](#attributes-4)

TypeNameDescriptionRequiredDefaultstring`label`Column labelx-string`token`Column label token for translatorx-boolean`sortable`Enable or disable column sorting-`true`boolean`orderable`Enable or disable column sorting (alias)-`true`string`width`Column width-`"auto"`string`class`Column class (individual `td` classes)--string`type`Column type (html, string, numeric, date)-`"html"`Only either of `label` or `token` is required.

#### Usage

[](#usage-4)

```
{datatable_column token="language/file.and.token" width="120px" sortable=false}
```

---

[Back to top](#laravel-4-smarty-view)

### Form

[](#form)

The **form** block tag opens and closes form:

```
return Form::open($params)
       . $content
       . Form::close()
```

Return value is type of `string`, with generated HTML form.

#### Attributes

[](#attributes-5)

All parameters passed to `Form::open` method as HTML attributes.

#### Usage

[](#usage-5)

```
{form action="route name" class="form-horizontal" role="form"}

...

{/form}
```

HTML output:

```

    ...

```

---

[Back to top](#laravel-4-smarty-view)

### Form checkbox

[](#form-checkbox)

The `form_checkbox` is alias for `Form::checkbox`.

Return value is type of `string`, with generated HTML checkbox input field.

#### Attributes

[](#attributes-6)

TypeNameDescriptionRequiredDefaultstring`_name`HTML `name` attributex-mixed`_value`checkbox `value` attribute-`null`boolean`_checked`if `true` checkbox will be checked, otherwise not-`false`boolean`_populate`if `true` old input data will be used-`false`#### Usage

[](#usage-6)

```
{form_checkbox _name="field-checkbox" _checked=true class="checkbox"}
```

---

[Back to top](#laravel-4-smarty-view)

### Form file

[](#form-file)

The `form_file` is alias for `Form::file`.

Return value is type of `string`, with generated HTML file input field.

#### Attributes

[](#attributes-7)

TypeNameDescriptionRequiredDefaultstring`_name`HTML `name` attributex-#### Usage

[](#usage-7)

```
{form_file _name="field-file"}
```

---

[Back to top](#laravel-4-smarty-view)

### Form hidden

[](#form-hidden)

The `form_hidden` is alias for `Form::hidden`.

Return value is type of `string`, with generated HTML hidden input field.

#### Attributes

[](#attributes-8)

TypeNameDescriptionRequiredDefaultstring`_name`HTML `name` attributex-mixed`_value`hidden field `value` attribute-`null`boolean`_populate`if `true` old input data will be used-`false`#### Usage

[](#usage-8)

```
{form_hidden _name="field-hidden" value="hidden-value"}
```

### Form password

[](#form-password)

The `form_password` is alias for `Form::password`.

Return value is type of `string`, with generated HTML password input field.

#### Attributes

[](#attributes-9)

TypeNameDescriptionRequiredDefaultstring`_name`HTML `name` attributex-#### Usage

[](#usage-9)

```
{form_password _name="field-password"}
```

---

[Back to top](#laravel-4-smarty-view)

### Form radio

[](#form-radio)

The `form_radio` is alias for `Form::radio`.

Return value is type of `string`, with generated HTML radio input field.

#### Attributes

[](#attributes-10)

TypeNameDescriptionRequiredDefaultstring`_name`HTML `name` attributex-mixed`_value`radio `value` attribute-`null`boolean`_checked`if `true` radio will be checked, otherwise not-`false`boolean`_populate`if `true` old input data will be used-`false`#### Usage

[](#usage-10)

```
{form_radio _name="field-radio" _checked=true class="radio"}
```

---

[Back to top](#laravel-4-smarty-view)

### Form select

[](#form-select)

The `form_select` is alias for `Form::select` or `Form::selectRange`.

Return value is type of `string`, with generated HTML select field.

#### Attributes

[](#attributes-11)

TypeNameDescriptionRequiredDefaultstring`_name`HTML `name` attributex-string`_default`radio `value` attribute-`null`string\[\]`_list`select items as associative array-`array()`mixed`_selected`selected index value-`array()`boolean`_range`if `true` radio will be generated as select range-`false`string`_begin`range start valueif range is true`""`string`_end`range end valueif range is true`""`boolean`_populate`if `true` old input data will be used-`false`#### Usage

[](#usage-11)

```
{form_select _name="field-checkbox" _list=$data}
```

```
{form_select _name="field-checkbox" _range=true _begin=5 _end=100 class="checkbox"}
```

---

[Back to top](#laravel-4-smarty-view)

### Form text

[](#form-text)

The `form_text` is alias for `Form::text`.

Return value is type of `string`, with generated HTML text field.

#### Attributes

[](#attributes-12)

TypeNameDescriptionRequiredDefaultstring`_name`HTML `name` attributex-string`_value`text `value` attribute-`null`boolean`_populate`if `true` old input data will be used-`false`#### Usage

[](#usage-12)

```
{form_text _name="field-text" class="text"}
```

---

[Back to top](#laravel-4-smarty-view)

### Form textarea

[](#form-textarea)

The `form_textarea` is alias for `Form::textarea`.

Return value is type of `string`, with generated HTML textarea field.

#### Attributes

[](#attributes-13)

TypeNameDescriptionRequiredDefaultstring`_name`HTML `name` attributex-string`_value`textarea `value` attribute-`null`boolean`_populate`if `true` old input data will be used-`false`#### Usage

[](#usage-13)

```
{form_textarea _name="field-textarea" class="textarea"}
```

---

[Back to top](#laravel-4-smarty-view)

License
-------

[](#license)

This package is licensed under the MIT License

---

[Back to top](#laravel-4-smarty-view)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 98% 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 ~6 days

Recently: every ~14 days

Total

20

Last Release

4255d ago

Major Versions

v1.0.9 → 4.1.x-dev2014-06-18

PHP version history (2 changes)v1.0.0PHP &gt;=5.3.0

v1.0.12PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/97ac6badd847093e56369390bf36ddbb8740e10a8a495b339c2adb78e7345663?d=identicon)[vincekovacs](/maintainers/vincekovacs)

---

Top Contributors

[![vincekovacs](https://avatars.githubusercontent.com/u/1031595?v=4)](https://github.com/vincekovacs "vincekovacs (50 commits)")[![hackur](https://avatars.githubusercontent.com/u/161835?v=4)](https://github.com/hackur "hackur (1 commits)")

---

Tags

laravelviewsmarty

### Embed Badge

![Health badge](/badges/vi-kon-laravel-smarty-view/health.svg)

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

###  Alternatives

[ytake/laravel-smarty

Smarty template engine for Laravel and Lumen

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

This package lets you run Smarty3 on Laravel5 elegantly.

127.0k](/packages/latrell-smarty)[torann/device-view

Provides support for device based view layouts in Laravel.

146.6k](/packages/torann-device-view)[delatbabel/viewpages

Support rendering/view of Laravel pages and templates from a database.

121.4k](/packages/delatbabel-viewpages)

PHPackages © 2026

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