PHPackages                             neoisrecursive/inertia-tempest - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. neoisrecursive/inertia-tempest

ActiveLibrary[Framework](/categories/framework)

neoisrecursive/inertia-tempest
==============================

A inertia adapter for the tempestphp framework

v1.0.0-rc.2(1mo ago)125.5k↓92.4%[5 issues](https://github.com/NeoIsRecursive/inertia-tempest/issues)MITPHPPHP ^8.5CI passing

Since Jul 9Pushed 3w ago2 watchersCompare

[ Source](https://github.com/NeoIsRecursive/inertia-tempest)[ Packagist](https://packagist.org/packages/neoisrecursive/inertia-tempest)[ RSS](/packages/neoisrecursive-inertia-tempest/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (6)Dependencies (9)Versions (16)Used By (0)

Inertia tempest
===============

[](#inertia-tempest)

[![Coverage Status](https://camo.githubusercontent.com/ca085034b7016f4a617e88160d25608671484478a08cca3fe5c37167ca85870c/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4e656f49735265637572736976652f696e65727469612d74656d706573742f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/NeoIsRecursive/inertia-tempest?branch=main)

installation
------------

[](#installation)

```
composer require neoisrecursive/inertia-tempest
```

Setup
-----

[](#setup)

It should be very familiar if you have used inertia before, with some small differences, for example:

- No configuration is done in the middleware, use the the config file, a provider class or your own middleware to set your "globally-shared-props".
- No automatic redirect back handling in non get requests, since all tempest routes must return a response you have to return your own `Back` response.
- Includes all validation errors for each field by default, instead of just the first one.

We provide an installer that you can use to set up some of the boilerplate code, but you can also do it manually.

### Installer

[](#installer)

First run the tempest vite installer (the inertia installer assumes you use vite):

```
./tempest install vite
```

Then you can run the inertia installer:

```
./tempest install inertia
```

Then all you have to do is to follow the instructions in the terminal. The only manual step is to add the vite plugin for your fe-framework to the vite config file.

### Manual setup

[](#manual-setup)

If you don't want to use the installer, you can do the following steps manually:

#### Backend

[](#backend)

If you use the default config, a view called `app.view.php` is required. That view will then be rendered as an `NeoIsRecursive\Inertia\Views\InertiaBaseView` and to render the inertia element you just do:

```

```

#### Frontend

[](#frontend)

Install the bundler of your choice, since tempest comes with a vite installer, that is very much recommended. [Tempest vite docs](https://tempestphp.com/1.x/features/asset-bundling).

When that is done, you can go on to install your prefered inertia client by following the guide on inertia's official site [here](https://inertiajs.com/client-side-setup)

### Usage

[](#usage)

It is pretty similar to the Laravel adapter, except that to return an Inertia respone, you return a `Component` instance - like in your other Tempest routes.

```
use Tempest\Http\Get;
use NeoIsRecursive\Inertia\Http\Component;

final class ReviewController
{
    #[Get(uri: '/reviews/{review}')]
    public function show(Review $review): Component
    {
        return new Component('reviews/show', [
            'review' => $review,
        ]);
    }
}
```

Configuration
-------------

[](#configuration)

This is the default config:

```
