typo3fluid/fluid
TYPO3Fluid is a standalone PHP templating engine extracted from TYPO3 CMS. It provides secure, flexible templates with ViewHelpers, layouts, sections and partials, plus extensibility and caching, making it suitable for MVC apps and reusable component rendering.
f:format., f:if) mirrors Laravel’s directives but with stronger validation (e.g., StrictArgumentProcessor). This could replace Blade for projects requiring compile-time safety or enterprise-grade templating.{{ component('header') }}).Fluid class can be bootstrapped via Laravel’s service container, with template paths mapped to Laravel’s resources/views.@layout and @section directives can emulate Laravel’s stacked views or master layouts.fluid warmup) and opcode caching, comparable to Blade’s compiled views.iterable), which may require migrating custom ViewHelpers.*.fluid.html) are optional but recommended for new projects.<f:for>) differs from Blade’s {!! !!} or @foreach.laravel-shift/fluid could help.)@stack)?fluid warmup) integrate with Laravel’s cache drivers?Fluid class as a view resolver alongside Blade.resources/views to Fluid’s templateRootPath.TemplateParser, ViewHelperResolver, etc., as Laravel services.return Fluid::render('page', ['user' => $user])).@layout and @section directives.*.fluid.blade.php).// app/Providers/AppServiceProvider.php
View::addLocation(public_path('resources/views'));
View::addExtension('fluid', function ($view) {
return Fluid::render($view->name(), $view->data());
});
about.fluid.html) first.@component) with Fluid partials (<f:render partial="partial" />).fluid analyze) to validate templates pre-deployment.@component, @template).| Feature | Blade Support | Fluid Support | Workaround |
|---|---|---|---|
| Template Inheritance | @extends |
@layout |
Map @extends to @layout |
| Sections | @section |
@section |
Direct compatibility |
| Components | @component |
<f:render> |
Custom ViewHelper |
| Directives | {!! !!} |
{} |
Use {{{ }}} for raw output |
| Stacks | @stack |
No | Custom ViewHelper or JS |
| Inertia.js | Yes | No | Proxy through Blade or JS |
composer require typo3fluid/fluid.config/app.php:
'view' => [
'resolvers' => [
FluidResolver::class,
// BladeResolver remains for dual support
],
],
@foreach → <f:for>).@foreach($items as $item)
{{ $item->name }}
@endforeach
→
<f:for each="{items}" as="item">
{item.name}
</f:for>
@stack).namespace App\ViewHelpers;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
class StackViewHelper extends AbstractViewHelper {
public function render(): string {
// Implement stack logic
}
}
php artisan fluid:warmup).fluid analyze) help catch issues pre-deployment.fluid warmup) reduce runtime parsing overhead.laravel-debugbar or custom benchmarks.View::flush()).How can I help you explore Laravel packages today?