PHPackages                             sarah-systems/ci4smarty - 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. sarah-systems/ci4smarty

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

sarah-systems/ci4smarty
=======================

Smarty for CodeIgniter4

0.1.5(1y ago)11.4k↓33.3%MITPHPPHP &gt;=7.2

Since May 12Pushed 1y ago1 watchersCompare

[ Source](https://github.com/kohenji01/CI4Smarty)[ Packagist](https://packagist.org/packages/sarah-systems/ci4smarty)[ RSS](/packages/sarah-systems-ci4smarty/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (7)Used By (0)

Smarty for CodeIgniter4
=======================

[](#smarty-for-codeigniter4)

CodeIgniter4用のSmarty組み込みです。

Install
=======

[](#install)

Composerで導入可能です。CI4やSmartyも予めComposerでインストールしておいてください。

```
$ composer require sarah-systems/ci4smarty
```

Usage
=====

[](#usage)

デフォルトでは、Smarty関連のパスは自体は次のような設定で動作するようになっています。

種類パステンプレートapp/Viewsコンパイルwritable/smarty/templates\_cキャッシュwritable/smarty/cacheコンフィグwritable/smarty/config`writable`が正しく書き込み可能な場合、下の3つのディレクトリは自動的に生成されます。 もしエラーが起きた場合は、これらのディレクトリを作って適切なパーミッションを与えることで動作します。

もしこのパスを変更したい場合は`.env`ファイルに次のパラメータをセットすることで、任意のパスに変更可能です。

```
CI4Smarty.TemplateDir = /path/to/TemplateDir
CI4Smarty.CompileDir = /path/to/CompileDir
CI4Smarty.LeftDelimiter = {{
CI4Smarty.RightDelimiter = }}
CI4Smarty.CacheDir = /path/to/CacheDir
CI4Smarty.ConfigDir = /path/to/ConfigDir
```

これ以外にも`.env`では、SmartyのDebugフラグのOn/Offとデフォルトのテンプレート拡張子を設定できます。

```
CI4Smarty.Debug = 1 または 0
CI4Smarty.DefaultTemplateExtension = .tpl
```

### view()

[](#view)

CI4のview関数をSmarty用にCI4Smartyというnamespaceで定義しています。

利用する際は`app`ディレクトリ直下の`Common.php`に次を追記してください。

```
require_once ROOTPATH . "vendor/sarah-systems/ci4smarty/src/Common.php";
```

使用法はCI4のview関数と同じですが、関数の利用時には名前空間を指定するか、事前にエイリアスを張ってください。

```
\CI4Smarty\view('template.tpl');
```

または

```
use function CI4Smarty\view as view;
view('template.tpl');
```

拡張子`.tpl`（`CI4Smarty.DefaultTemplateExtension`で設定されたものです。無指定の場合は`.tpl`）は省略可能です。

```
view('template');
```

view関数の第2パラメータはSmarty変数`$CI`にアサインされます。

```
$data = [ 'apple' , 'banana' , 'lemon' ];
view('template',$data);
```

Smartyのtemplate上では

```
{$CI.0} assign('time',$time);
$smarty->display('template.tpl');
```

License
=======

[](#license)

The source code is licensed MIT. The website content is licensed CC BY 4.0,see LICENSE.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~315 days

Recently: every ~392 days

Total

6

Last Release

611d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f8cd6e32667d45972728160d8dd47de3d769ef0e3172f12a7b70c7c8e32e80ac?d=identicon)[kohenji01](/maintainers/kohenji01)

---

Top Contributors

[![kohenji01](https://avatars.githubusercontent.com/u/8407272?v=4)](https://github.com/kohenji01 "kohenji01 (11 commits)")

### Embed Badge

![Health badge](/badges/sarah-systems-ci4smarty/health.svg)

```
[![Health](https://phpackages.com/badges/sarah-systems-ci4smarty/health.svg)](https://phpackages.com/packages/sarah-systems-ci4smarty)
```

###  Alternatives

[modx/revolution

MODX Revolution is a Content Management System

1.4k9.1k12](/packages/modx-revolution)[ytake/laravel-smarty

Smarty template engine for Laravel and Lumen

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

This Symfony bundle provides integration for the Smarty3 template engine.

53194.4k1](/packages/noiselabs-smarty-bundle)

PHPackages © 2026

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