Tempest 1.5

This release brings a new markdown view component, CSRF support, installable view components, and more.

by Brent on July 29, 2025

Installable view components

We made some pretty significant changes to view component's discovery. These changes now make it possible to ship view components from the framework or via third-party packages and publish them when needed:

./tempest install view-components

  Select which view components you want to install
  / Filter...
  → ⋅ x-csrf-token
    ⋅ x-markdown
    ⋅ x-input
    ⋅ x-icon
 
// …

This refactor came with some breaking changes though. Tempest View is still an experimental component of the framework, so occasional breaking changes might happen. We documented the how and why of these changes in a separate blog post. In the end, these changes made a lot of sense, and it's great to see how Discovery made the installer part with vendor- and project-based view components trivial to add.

Apart from the view component installer, we also made a bunch of fixes to how view components deal with local and global variable scope, and we added a bunch more built-in view components that ship with the framework:

  • <x-base />: a barebone base layout with Tailwind CDN included
  • <x-form />: a form component which posts by default and includes the csrf token out of the box
  • <x-input />: a flexible component to render form inputs
  • <x-submit />: renders a submit button
  • <x-markdown />: a component to render markdown, either inline or from a variable

You can read more about built-in view components in the docs.

CSRF support

Any form request will now have CSRF protection. Because CSRF protection is enabled by default, you will need to add the new <x-csrf-token /> element to your forms (it is included by default when you use <x-form />).

<form action="…">
    <x-csrf-token />
</form>

Database pagination

The select query builder now has pagination support:

$chapters = query(Chapter::class)
    ->select()
    ->whereField('book_id', $book->id)
    ->paginate();

New Json response

We've added a new Json response class that can be returned from controllers and will include the necessary JSON headers:

use Tempest\Http\Responses\Json;

#[Get('/books')]
public function books(): Response
{
    // …
    return new Json($books);
}

View data testers

We added some additional assertion methods to our HTTP tester, so that you can make assertions on view data directly:

public function test_can_assert_view_data(): void
{
    $this->http
        ->get(uri([TestController::class, 'withView']))
        ->assertViewData('name')
        ->assertViewData('name', function (array $data, string $value): void {
            $this->assertEquals(['name' => 'Brent'], $data);
            $this->assertEquals('Brent', $value);
        })
        ->assertViewDataMissing('email');
}

That's all the notable new features in Tempest 1.5. Of course, there are a bunch of bug fixes as well. Click here to read the full changelog.