Skip to content

Installation

Muhammet Şafak edited this page Jun 11, 2026 · 1 revision

Installation

initphp/views is distributed via Packagist. The core package has no runtime dependencies — only the adapter you choose may need an engine.

Requirements

Requirement Notes
PHP >= 8.0 The code uses declare(strict_types=1), mixed, union and static return types.
Composer For installation and autoloading.

Per-adapter engines

Adapter Engine package Versions
Pure PHP none — PHP core only
Blade illuminate/view ^9.0 · ^10.0 · ^11.0
Twig twig/twig ^3.0

You only need the engine for the adapter you actually use. The Pure PHP adapter works on any PHP 8 install with no extra setup.

Install

composer require initphp/views

Then install the engine for the adapter you want (skip this for Pure PHP):

composer require illuminate/view   # for BladeAdapter
composer require twig/twig         # for TwigAdapter

Composer registers the PSR-4 namespace InitPHP\Views\ and autoloads the global view() helper, so everything is available as soon as you require vendor/autoload.php.

Verify the install

Drop this script into your project root as check-views.php:

<?php

declare(strict_types=1);

require __DIR__ . '/vendor/autoload.php';

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

$dir = __DIR__ . '/views';
@mkdir($dir, 0775, true);
file_put_contents($dir . '/check.php', 'InitPHP Views <?= $status ?>');

View::via(new PurePHPAdapter($dir));

echo view('check', ['status' => "is working.\n"]);
php check-views.php
# InitPHP Views is working.

Next steps

Clone this wiki locally