PHPackages                             initphp/views - 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. initphp/views

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

initphp/views
=============

InitPHP Views Engine

1.0(3y ago)0441MITPHPPHP &gt;=8.0

Since Jan 14Pushed 3y ago1 watchersCompare

[ Source](https://github.com/InitPHP/Views)[ Packagist](https://packagist.org/packages/initphp/views)[ RSS](/packages/initphp-views/feed)WikiDiscussions master Synced 1mo ago

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

InitPHP Views
=============

[](#initphp-views)

### Installation

[](#installation)

```
composer require initphp/views

```

### Usage

[](#usage)

***Note :** Remember to choose to work with an adapter before using it.*

```
$data = [
    'username'  => 'admin'
];

echo view('dashboard/dashboard', $data);
```

Give a string array to load multiple views.

```
$data = [
    'username'  => 'admin'
];

echo view(['header', 'content', 'footer'], $data);
```

`$data` can be an associative array or an object.

```
$data = new stdClass;
$data->username = 'admin';

echo view('dashboard/profile', $data);
```

Adapters
--------

[](#adapters)

### PurePHP Adapter

[](#purephp-adapter)

```
use \InitPHP\Views\Facade\View;
use \InitPHP\Views\Adapters\PurePHPAdapter;

$viewAdapter = new PurePHPAdapter(__DIR__ . '/Views/');

View::via($viewAdapter);
```

**Note :** This adapter uses `.php` for the extension of the view files. If the view file does not end with `.php` it is added automatically.

**Note :** This adapter includes the view files as a PHP file at runtime.

### Laravel Blade (Illuminate/View) Adapter

[](#laravel-blade-illuminateview-adapter)

Don't forget to install the relevant packages before you start.

```
composer require illuminate/view

```

To start using the adapter, just generate the Instance of the relevant adapter.

```
use \InitPHP\Views\Facade\View;
use \InitPHP\Views\Adapters\BladeAdapter;

$viewAdapter = new BladeAdapter(__DIR__ . '/Views/', __DIR__ . '/Cache/');

View::via($viewAdapter);
```

**Note :** This adapter may have some unique changes. [Docs](https://laravel.com/docs/9.x/blade)

```
View::directive('now', function ($format = null) {
    return '';
});

// @now
// @now("Y-m-d")
```

### Symfony Twig (Twig/Twig) Adapter

[](#symfony-twig-twigtwig-adapter)

Don't forget to install the relevant packages before you start.

```
composer require twig/twig

```

To start using the adapter, just generate the Instance of the relevant adapter.

```
use \InitPHP\Views\Facade\View;
use \InitPHP\Views\Adapters\TwigAdapter;

$viewAdapter = new TwigAdapter(__DIR__ . '/Views/', __DIR__ . '/Cache/');

View::via($viewAdapter);
```

**Note :** Note that the Twig engine accepts any file extension and you have to specify it manually. [Docs](https://twig.symfony.com/doc/3.x/templates.html)

```
$data = [
    'username'  => 'admin'
];

echo view('dashboard/dashboard.html', $data);
```

Credits
-------

[](#credits)

- [Muhammet ŞAFAK](https://www.muhammetsafak.com.tr) &lt;&gt;

License
-------

[](#license)

Copyright © 2022 [MIT License](./LICENSE)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

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

Unknown

Total

1

Last Release

1218d 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 (2 commits)")

### Embed Badge

![Health badge](/badges/initphp-views/health.svg)

```
[![Health](https://phpackages.com/badges/initphp-views/health.svg)](https://phpackages.com/packages/initphp-views)
```

###  Alternatives

[mustache/mustache

A Mustache implementation in PHP.

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

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[nicmart/string-template

StringTemplate is a very simple string template engine for php. I've written it to have a thing like sprintf, but with named and nested substutions.

2101.7M30](/packages/nicmart-string-template)

PHPackages © 2026

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