jdifool/tempest-fluid-view

A Fluid view renderer for Tempest PHP.

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/jdifool/tempest-fluid-view

dev-main 2025-11-30 18:12 UTC

This package is auto-updated.

Last update: 2025-11-30 21:08:45 UTC


README

This package allows to use the Fluid template engine in a Tempest application.

Usage

First install this Fluid view renderer package (it also installs the required Fluid engine provided by the typo3fluid/fluid package):

composer require jdifool/tempest-fluid-view

The next step is to provide the configuration needed for Fluid to find your view files.

<?php
// app/fluid.config.php

declare(strict_types=1);

use Jdifool\Tempest\View\Renderers\FluidConfig;

return new FluidConfig(
    templateRootPaths: [
        __DIR__ . '/../views/Templates/',
    ],
    partialRootPaths: [
        __DIR__ . '/../views/Partials/',
    ],
    layoutRootPaths: [
        __DIR__ . '/../views/Layouts/',
    ]
);

Finally, update the view configuration to use the Fluid view renderer:

<?php
// app/view.config.php

declare(strict_types=1);

use Tempest\View\ViewConfig;
use Jdifool\Tempest\View\Renderers\FluidViewRenderer;

return new ViewConfig(
    rendererClass: FluidViewRenderer::class
);

In your controller you can now use Fluid templates like so:

<?php
// app/HomeController.php

namespace App;

use Tempest\Router\Get;
use Tempest\View\View;
use function Tempest\view;

final readonly class HomeController
{
    #[Get('/')]
    public function __invoke(): View
    {
        $data = ['foo' => 'bar'];

        // __DIR__ . '/../views/Templates/Home/Index.html'
        return view('Home/Index', ...$data);
    }
}