Migrating from v1.2.0 to v1.3.0¶
Table of Contents¶
New Features¶
Katana Blade render engine¶
Views are now rendered with Katana, a standalone implementation
of the Blade templating language. This brings real template
inheritance, reusable <x-...> components, shared partials and the full set of Blade directives
(@if, @foreach, @forelse, @include, and more) to your views. See the rewritten
Views documentation for what is now possible.
Breaking Changes¶
Views are now Blade templates¶
The old view format, a PHP file returning head and body closures, has been replaced by Blade
.blade.php templates. The change is mechanical and the migrator
applies it for you:
- A view's
bodyclosure becomes@section("content"). - A view's
headclosure becomes@section("head"). - Every view starts with
@extends($layout), so the view plugs into the layout the controller chose. - Layouts drop their
$body($opt)/$head($opt)calls in favor of@yield("content")/@yield("head"), and the framework essentials become the<x-zubzet::head :opt="$opt"/>and<x-zubzet::body :opt="$opt"/>components.
Before:
<?php return ["body" => function($opt) { ?>
<h1><?= $opt["title"] ?></h1>
<?php }]; ?>
After:
@extends($layout)
@section("content")
<h1>{{ $opt["title"] }}</h1>
@endsection
Plain PHP still works inside a .blade.php file, so raw <?php ?> blocks in your views keep running
unchanged. See the Views documentation for the full picture.
Upgrade Steps¶
Follow these steps to upgrade your project to v1.3.0.
1. Automated migration (recommended)¶
The ZubZet Version Migrator converts every view and layout in your project automatically.
- Clone the tool: zubzet/version-migration
- Preview the changes with a dry run, then apply them:
php application.php upgrade {PATH_TO_YOUR_PROJECT} 1.2.0 1.3.0 --dry
php application.php upgrade {PATH_TO_YOUR_PROJECT} 1.2.0 1.3.0
The migrator bumps the framework dependency and rewrites every return [...] view and layout to Blade
(.blade.php), including the section, @extends and essentials-component changes above. Review each
prompted change before accepting it.
2. Review your migrated views¶
The conversion is output preserving, but it is worth skimming the result. Views that already used raw
<?php ?> keep it verbatim, and anything the framework could not classify is left as raw PHP rather
than guessed at. Once you are comfortable with Blade, you can gradually adopt directives like
@foreach or components where they make a template clearer. The
Views documentation covers what is available.