PHPackages                             muhammetsafak/ice-engine - 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. muhammetsafak/ice-engine

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

muhammetsafak/ice-engine
========================

ICE Engine : Basic PHP Template Engine

0.3(4y ago)04MITPHPPHP &gt;=7.4

Since Apr 23Pushed 4y ago1 watchersCompare

[ Source](https://github.com/muhammetsafak/IceEngine)[ Packagist](https://packagist.org/packages/muhammetsafak/ice-engine)[ RSS](/packages/muhammetsafak-ice-engine/feed)WikiDiscussions main Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

IceEngine
=========

[](#iceengine)

ICE Engine : Basic PHP Template Engine

[![Latest Stable Version](https://camo.githubusercontent.com/1b29508ca2001bf4d4e206aa9f9646982db9d0dfb31fb27c4a3368f689b57936/687474703a2f2f706f7365722e707567782e6f72672f6d7568616d6d6574736166616b2f6963652d656e67696e652f76)](https://packagist.org/packages/muhammetsafak/ice-engine) [![Total Downloads](https://camo.githubusercontent.com/07f7b5710a33353757fb28900683a8518770d2cf40dcc1d5a99a931d4e50c6c7/687474703a2f2f706f7365722e707567782e6f72672f6d7568616d6d6574736166616b2f6963652d656e67696e652f646f776e6c6f616473)](https://packagist.org/packages/muhammetsafak/ice-engine) [![Latest Unstable Version](https://camo.githubusercontent.com/294e710d81aeb8ae37176a7a38a336168979c22743ee54515799259982dd5dd7/687474703a2f2f706f7365722e707567782e6f72672f6d7568616d6d6574736166616b2f6963652d656e67696e652f762f756e737461626c65)](https://packagist.org/packages/muhammetsafak/ice-engine) [![License](https://camo.githubusercontent.com/d954142b6bcdac4e2d47a4896f8c2d5104dec3ee19860deb33bf13f4fb38feda/687474703a2f2f706f7365722e707567782e6f72672f6d7568616d6d6574736166616b2f6963652d656e67696e652f6c6963656e7365)](https://packagist.org/packages/muhammetsafak/ice-engine) [![PHP Version Require](https://camo.githubusercontent.com/d1349fe2abea188e3b4d9bf6cdec1ef809f70be42704c89ba5bd6f0851c7a411/687474703a2f2f706f7365722e707567782e6f72672f6d7568616d6d6574736166616b2f6963652d656e67696e652f726571756972652f706870)](https://packagist.org/packages/muhammetsafak/ice-engine)

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

[](#installation)

```
composer require muhammetsafak/ice-engine

```

[![iceengine](https://user-images.githubusercontent.com/9823597/148836439-e5c99304-29c0-4be9-b903-f80dbb7229ed.png)](https://user-images.githubusercontent.com/9823597/148836439-e5c99304-29c0-4be9-b903-f80dbb7229ed.png)

Engine Methods
--------------

[](#engine-methods)

### `timeout()`

[](#timeout)

The lifetime determines the maximum lifetime for the views cache.

```
public function timeout(?int $ttl = 86400): self
```

If `NULL` is defined, the cache remains valid until the view file is modified.

An integer of `0` or less means that the cache will be refreshed each time.

### `extension()`

[](#extension)

Defines the extension of the view files.

```
public function extension(string $extension = '.template.php'): self
```

### `parse()`

[](#parse)

Loads and executes the specified view file.

```
public function parse(string $name, array|object $data = []): void
```

### `compress()`

[](#compress)

Specifies whether to compress the cache output.

```
public function compress(bool $compress = false): self
```

*Note :* It simply means deleting multiple spaces in the cache file.

### `directive()`

[](#directive)

It allows you to add directives suitable for your own project.

```
public function directive(string $directive, \Closure $closure): self
```

See [Custom Directives](#custom-directives) for details.

Usage
-----

[](#usage)

```
$iceEngine = new \IceEngine\Engine(__DIR__ . '/views/', __DIR__ . '/cache/');

$iceEngine->parse('index');
```

Internal Directives
-------------------

[](#internal-directives)

### Extends

[](#extends)

```
@extends('layout')

```

### Yield &amp; Section

[](#yield--section)

```
@yield('title')

```

```
@section('title', 'Page Title')

```

```
@section('content')
    ...
@endsection

```

```
@include('view')

```

### Loops

[](#loops)

```
@for($i = 0; $i < 5; $i++)
    ...
@endfor

```

```
@foreach($rows as $row)
    ...
@endwhile

```

```
@while(true)
    ...
@endwhile

```

### Continue &amp; Break

[](#continue--break)

```
@continue

```

```
@break

```

*Conditional use of continue and break*

```
@continue($i == 5)

```

```
@break($i == 5)

```

#### If/Else

[](#ifelse)

```
@if($i == 4)
    ...
@else
    ...
@endif

```

```
@if($i == 4)
    ...
@elseif($i == 5)
    ...
@else
    ...
@endif

```

#### Switch/Case

[](#switchcase)

```
@switch($data)
    @case(5)
        ...
    @break
    @case(6)
        ...
    @break
    @default
        ...
@endswitch

```

#### Isset &amp; Empty

[](#isset--empty)

```
@isset($data)
    ...
@endisset

```

```
@empty($data)
    ...
@endempty

```

### PHP Command

[](#php-command)

```
@php
    ...
@endphp

```

### Comments

[](#comments)

```
{{-- Comments --}}

```

### Variables

[](#variables)

```
{{ $name }}

```

```
{!! $name !!}

```

### Form

[](#form)

```
@form('action.php', 'POST')
    @label('Username', 'username')
    @input('username', 'text', ['id' => 'username'])

    @label('Password', 'password')
    @input('password', 'password', ['id' => 'password'])

    @label('Biography', 'bio')
    @textarea('biography', '', ['id' => 'bio'])

    @label('Gender', 'gender')
    @select('sex', ['man' => 'Man', 'woman' => 'Woman', 'other' => 'Other'], ['id' => 'gender'], 'other')

    @button('Reset', ['type' => 'reset']);

    @submit('Login')
@endform

```

The html form example that the above example would produce should look like this.

```

    Username

    Password

    Biography

    Gender

        Man
        Woman
        Other

    Reset

```

Custom Directives
-----------------

[](#custom-directives)

```
$iceEngine->directive('style', function($href = null){
    if($href !== null){
        return '';
    }
    return '';
});

$iceEngine->directive('endstyle', function(){
   return '';
});
```

Usage of the above directives would look like this;

```
@style('https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css')

@style
body{
    background: #fff;
}
@endstyle

```

In this example, IceEngine generates HTML like this:

```

    body{
        background: #fff;
    }

```

License
-------

[](#license)

This library was developed by [Muhammet ŞAFAK](https://www.muhammetsafak.com.tr) and distributed under the [MIT License](./LICENSE).

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

1533d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b6b34f3ac8938d8ee52ba3bd260680855dc5715c7b2929d9380de30d15a67dd?d=identicon)[muhammetsafak](/maintainers/muhammetsafak)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/muhammetsafak-ice-engine/health.svg)

```
[![Health](https://phpackages.com/badges/muhammetsafak-ice-engine/health.svg)](https://phpackages.com/packages/muhammetsafak-ice-engine)
```

###  Alternatives

[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3851.2M](/packages/limenius-react-bundle)[area17/laravel-auto-head-tags

Laravel Auto Head Tags helps you build the list of head elements for your app

4616.1k](/packages/area17-laravel-auto-head-tags)[ktquez/laravel-tinymce

TinyMCE editor for Laravel and Lumen Framework

2525.4k](/packages/ktquez-laravel-tinymce)[jelix/wikirenderer

WikiRenderer is a library to generate HTML or anything else from wiki content.

1712.3k1](/packages/jelix-wikirenderer)[webkinder/sproutset

A Composer package for handling responsive images in Roots Bedrock + Sage + Blade projects.

282.2k](/packages/webkinder-sproutset)

PHPackages © 2026

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