PHPackages                             everest-php/razr - 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. everest-php/razr

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

everest-php/razr
================

Razr - The powerful PHP template engine

1.0.1(8y ago)0821MITPHPPHP &gt;=5.3.3

Since Jul 26Pushed 8y ago1 watchersCompare

[ Source](https://github.com/everest-php/razr)[ Packagist](https://packagist.org/packages/everest-php/razr)[ Docs](http://pagekit.com)[ RSS](/packages/everest-php-razr/feed)WikiDiscussions master Synced 3d ago

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

Razr - The powerful PHP template engine
=======================================

[](#razr---the-powerful-php-template-engine)

Razr is a powerful PHP template engine for PHP, whose syntax was inspired by ASP.NET Razor.

Usage
-----

[](#usage)

Render a template:

```
$razr = new Razr\Engine(new Razr\Loader\StringLoader);
echo $razr->render('Hello @( $name )!', array('name' => 'World'));
```

Render a template file with caching:

```
$razr = new Razr\Engine(new Razr\Loader\FilesystemLoader(__DIR__), '/path/to/cache');
echo $razr->render('hello.razr.php', array('name' => 'World'));
```

Syntax
------

[](#syntax)

The Razr syntax uses `@` as special character. It is used to indicate a dynamic statement for the template engine. Within the `@()` notation you may use regular PHP. The following statements are supported.

### Echo data

[](#echo-data)

Use the `@()` notation to echo any PHP data with escaping enabled by default.

**Example**

```
@( $title )
@( 23 * 42 )
@( " is escaped by default." )
```

**Output**

```
Some title
966
&lt;Data&gt; is escaped by default.
```

### Echo raw data

[](#echo-raw-data)

Use the `@raw()` directive to output any PHP data without escaping.

**Example**

```
@raw("This will not be escaped.")
```

**Output**

```
This will not be escaped.
```

### Variables

[](#variables)

You can access single variables and nested variables in arrays/objects using the following dot `.` notation.

```
array(
    'title' => 'I am the walrus',
    'artist' => array(
        'name' => 'The Beatles',
        'homepage' => 'http://www.thebeatles.com',
    )
)
```

**Example**

```
@( $title )
by @( $artist.name ), @( $artist.homepage )
```

**Output**

```
I am the walrus
by The Beatles, http://www.thebeatles.com
```

### Set variable values

[](#set-variable-values)

**Example**

```
@set($msg = "Hello World!")
@( $msg )
```

**Output**

```
Hello World!
```

### Conditional control structures

[](#conditional-control-structures)

Use `@if`, `@elseif`, `@else` for conditional control structures. Use any boolean PHP expression.

**Example**

```
@set($expression = false)
@if( $expression )
    One.
@elseif ( !$expression )
    Two.
@else
    Three.
@endif
```

**Output**

```
Two.
```

### Loops

[](#loops)

You can use loop statements like `foreach` and `while`.

```
@foreach($values as $key => $value)
    @( $key ) - @( $value )
@endforeach

@foreach([1,2,3] as $number)
    @( $number )
@endforeach

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

### Include

[](#include)

Extract reusable pieces of markup to an external file using partials and the `@include` directive. You can pass an array of arguments as a second parameter.

**Example**

```
@include('partial.razr', ['param' => 'parameter'])
```

`partial.razr`:

```
Partial with @( $param )
```

**Output**

```
Partial with parameter
```

### Extending templates with blocks

[](#extending-templates-with-blocks)

Use the `@block` directive to define blocks inside a template. Other template files can extend those files and define their own content for the defined blocks without changing the rest of the markup.

**Example**

```
@include('child.razr', ['param' => 'parameter'])
```

`parent.razr`:

```
Parent template

@block('contentblock')
    Parent content.
@endblock

Parent content outside of the block.
```

`child.razr`:

```
@extend('parent.razr')

@block('contentblock')
    You can extend themes and overwrite content inside blocks. Paremeters are available as well: @( $param ).
@endblock
```

**Output**

```
Parent template

You can extend themes and overwrite content inside blocks. Paremeters are available as well: parameter.

Parent content outside of the block.
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 53.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 ~1311 days

Total

2

Last Release

2999d ago

### Community

Maintainers

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

---

Top Contributors

[![steffans](https://avatars.githubusercontent.com/u/321013?v=4)](https://github.com/steffans "steffans (8 commits)")[![janschoenherr](https://avatars.githubusercontent.com/u/355427?v=4)](https://github.com/janschoenherr "janschoenherr (6 commits)")[![floriandotpy](https://avatars.githubusercontent.com/u/1116784?v=4)](https://github.com/floriandotpy "floriandotpy (1 commits)")

---

Tags

templatingpagekit

### Embed Badge

![Health badge](/badges/everest-php-razr/health.svg)

```
[![Health](https://phpackages.com/badges/everest-php-razr/health.svg)](https://phpackages.com/packages/everest-php-razr)
```

###  Alternatives

[twig/twig

Twig, the flexible, fast, and secure template language for PHP

8.4k443.2M5.8k](/packages/twig-twig)[mustache/mustache

A Mustache implementation in PHP.

3.3k44.6M291](/packages/mustache-mustache)[smarty/smarty

Smarty - the compiling PHP template engine

2.3k39.1M395](/packages/smarty-smarty)[timber/timber

Create WordPress themes with beautiful OOP code and the Twig Template Engine

5.7k3.4M111](/packages/timber-timber)[league/plates

Plates, the native PHP template system that's fast, easy to use and easy to extend.

1.5k5.9M232](/packages/league-plates)[eftec/bladeone

The standalone version Blade Template Engine from Laravel in a single php file

8208.4M87](/packages/eftec-bladeone)

PHPackages © 2026

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