-
-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
Muhammet Şafak edited this page Jun 11, 2026
·
1 revision
initphp/views is distributed via
Packagist. The core package has
no runtime dependencies — only the adapter you choose may need an engine.
| Requirement | Notes |
|---|---|
PHP >= 8.0 |
The code uses declare(strict_types=1), mixed, union and static return types. |
| Composer | For installation and autoloading. |
| 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.
composer require initphp/viewsThen install the engine for the adapter you want (skip this for Pure PHP):
composer require illuminate/view # for BladeAdapter
composer require twig/twig # for TwigAdapterComposer 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.
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.- Quick Start — register an adapter and render your first views.
- The View Facade & Helper — how the entry points work.
- Pick an adapter: Pure PHP, Blade, Twig.
initphp/views · MIT License · part of the InitPHP family
Source · Issues · Discussions · Packagist · Contributing · Security Policy
Getting Started
Adapters
Reference
Guides
Other