typo3fluid/fluid
TYPO3Fluid is a standalone PHP templating engine from TYPO3, providing the Fluid syntax for building secure, reusable templates with view helpers, layouts, partials, and caching. Use it in any PHP project without the full TYPO3 CMS stack.
TemplateParser, RenderingContext, and ViewHelper resolvers.RequestHandler can be adapted to work with Laravel’s middleware pipeline (e.g., for caching, localization, or auth checks).bin/fluid warmup can be adapted to run during Laravel’s optimize command (php artisan optimize:clear).@section('styles')) can be extended to work with Laravel Mix/Vite, though additional glue code may be needed for asset versioning and manifest integration..html to .fluid.html may need path rewrites or alias configurations.setChildNodes() (v5+) may affect legacy integrations.TemplateParser, ViewHelperResolver) may increase memory consumption in large applications.laravel-blade-components) be adapted or replaced?TemplateParser, RenderingContext) as Laravel services.$this->app->bind(\TYPO3Fluid\Fluid\View\TemplateParser::class, function ($app) {
return new \TYPO3Fluid\Fluid\View\TemplateParser(
new \TYPO3Fluid\Fluid\Core\Parser\Syntax\TemplateParserSyntax(),
new \TYPO3Fluid\Fluid\Core\Parser\TemplateParser()
);
});
ViewResolver to support .fluid.html files:
$this->app->extend('view.resolver', function ($resolver) {
$resolver->register('fluid', function () {
return new \App\View\FluidViewResolver();
});
return $resolver;
});
RequestHandler to work with Laravel’s middleware:
public function handle($request, Closure $next) {
$response = $next($request);
if ($response instanceof \Symfony\Component\HttpFoundation\Response) {
$content = Fluid::render($response->getContent(), $request->attributes->all());
$response->setContent($content);
}
return $response;
}
public function show(Post $post) {
return view('fluid.post', ['post' => $post]); // Renders post.fluid.html
}
app.blade.php → layout.fluid.html) first, as they are less dynamic.<f:render partial="header" />) to replace Blade @include directives.Card component).@auth, @csrf).| Feature | Blade | Fluid |
|---|---|---|
| Syntax | {!! !!} / @ directives |
{} / <f:> tags |
| Components | @component |
<f:component> |
| Conditional Logic | @if |
<f:if> |
| Loops | @foreach |
<f:for> |
| Asset Management | @vite() / @asset() |
Custom ViewHelper required |
| Caching | Blade cache | Fluid compiled cache |
@stack, @push, and @yield.typo3fluid/fluid via Composer.@auth → <f:if condition="{user->isAuthenticated()}">).How can I help you explore Laravel packages today?