PHPackages                             maartendekker/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. [API Development](/categories/api)
4. /
5. maartendekker/inertia-tempest

ActiveLibrary[API Development](/categories/api)

maartendekker/inertia-tempest
=============================

The Tempest adapter for Inertia.js.

v3.0.2(yesterday)52.3k↑260%3[4 issues](https://github.com/Maarten-Dekker/inertia-tempest/issues)[1 PRs](https://github.com/Maarten-Dekker/inertia-tempest/pulls)MITPHPPHP ^8.5CI passing

Since Aug 3Pushed 1mo agoCompare

[ Source](https://github.com/Maarten-Dekker/inertia-tempest)[ Packagist](https://packagist.org/packages/maartendekker/inertia-tempest)[ RSS](/packages/maartendekker-inertia-tempest/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (24)Versions (35)Used By (0)

Inertia.js Tempest Adapter
==========================

[](#inertiajs-tempest-adapter)

[![Unit Tests](https://github.com/Maarten-Dekker/inertia-tempest/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/Maarten-Dekker/inertia-tempest/actions/workflows/ci.yml/badge.svg?branch=main)[![Packagist License](https://camo.githubusercontent.com/e60623f508586f049d48cfb8396ee411b0c9bc3be174381a1893c37462a3c1e5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e63652d4d49542d626c7565)](https://choosealicense.com/licenses/mit)[![Latest Stable Version](https://camo.githubusercontent.com/edc488b3aa9a80dceec50f940adff6d3a7b9790756ca7c52edbd02f94393a5d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d61617274656e64656b6b65722f696e65727469612d74656d706573743f6c6162656c3d537461626c65)](https://packagist.org/packages/maartendekker/inertia-tempest)[![Total Downloads](https://camo.githubusercontent.com/2c0df092d9ed911ffc1ca25f20f8a36dc83d32ce28429dbd382ce29d96e6154c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d61617274656e64656b6b65722f696e65727469612d74656d706573743f6c6162656c3d446f776e6c6f616473)](https://packagist.org/packages/maartendekker/inertia-tempest)

A feature-complete Inertia.js adapter for the [Tempest](https://tempestphp.com) framework.
Mirrors the official [Inertia.js Laravel Adapter](https://github.com/inertiajs/inertia-laravel).

Server-side setup
-----------------

[](#server-side-setup)

### Install dependencies

[](#install-dependencies)

Install the Inertia server-side adapter using the Composer package manager.

```
composer require maartendekker/inertia-tempest
```

### Root template

[](#root-template)

Create a root view template `inertia.view.php` in your `app` directory. The adapter will automatically look for it.

```
>

        Inertia Tempest

```

The `` slot provides a fallback title that appears only when SSR is disabled; once SSR is enabled, it’s automatically replaced by the server‑rendered head output. With that in place, you’re ready to start building your Inertia pages using either the global `inertia()` helper or the `Inertia` facade.

```
use Inertia\Response;

final readonly class AircraftController
{
    #[Get('/aircraft/{aircraft}')]
    public function show(Aircraft $aircraft): Response
    {
        return inertia('Aircraft/Show', [ /* … */ ]);
    }
}
```

```
use Inertia\Inertia;
use Inertia\Response;

final readonly class AircraftController
{
    #[Get('/aircraft/{aircraft}')]
    public function show(Aircraft $aircraft): Response
    {
        return Inertia::render('Aircraft/Show', [ /* … */ ]);
    }
}
```

Client-side setup
-----------------

[](#client-side-setup)

### Install dependencies

[](#install-dependencies-1)

Install the Inertia client-side adapter corresponding to your framework of choice.

```
npm install @inertiajs/vue3
```

React```
npm install @inertiajs/react
```

Svelte```
npm install @inertiajs/svelte
```

### Initialize the Inertia app

[](#initialize-the-inertia-app)

Update your main JavaScript file to boot your Inertia app.

```
import { createInertiaApp } from '@inertiajs/vue3'
import { createApp, h } from 'vue'

void createInertiaApp({
    resolve: (name) => {
        const pages = import.meta.glob('./**/*.vue')
        return pages[`./${name}.vue`]()
    },
    setup({ el, App, props, plugin }) {
        createApp({ render: () => h(App, props) })
            .use(plugin)
            .mount(el)
    },
})
```

React```
import { createInertiaApp } from '@inertiajs/react'
import { createRoot } from 'react-dom/client'

void createInertiaApp({
    resolve: name => {
        const pages = import.meta.glob('./**/*.jsx')
        return pages[`./${name}.jsx`]()
    },
    setup({ el, App, props }) {
        createRoot(el).render()
    },
})
```

Svelte```
import { createInertiaApp } from '@inertiajs/svelte'
import { mount } from 'svelte'

void createInertiaApp({
    resolve: name => {
        const pages = import.meta.glob('./**/*.svelte')
        return pages[`./${name}.svelte`]()
    },
    setup({ el, App, props }) {
        mount(App, { target: el, props })
    },
})
```

Shared Data
-----------

[](#shared-data)

The `Inertia\Middleware\Middleware` class provides several defaults out-of-the-box. By default, the following data is shared on every request:

- **Errors:** Validation errors are automatically resolved and shared as `errors`.
- **Auth:** The current authenticated user (via Tempest Auth) is shared as `auth.user`.

### Customizing Shared Data

[](#customizing-shared-data)

To add your own shared data, you can extend the base middleware. Use `parent::share()` to keep the default error and auth logic, or overwrite it entirely.

```
use Inertia\Middleware\Middleware;

class HandleInertiaRequests extends Middleware
{
    public function share(): array
    {
        return array_replace_recursive(parent::share(), [
            'app_name' => 'My Tempest App',

            'workspace' => $this->session->get('workspace_id'),

            'statistics' => $this->inertia->defer(fn () => [
                'total_users' => User::count(),
                'active_projects' => Project::count(),
            ]),
        ]);
    }
}
```

Optional Configuration
----------------------

[](#optional-configuration)

This package works out-of-the-box with sensible defaults. To customize the settings, you can create an `inertia.config.php` file in your config directory. Because the configuration uses typed objects, your IDE will provide excellent autocompletion. You only need to specify the options you wish to change.

```
use Inertia\Configs\InertiaConfig;
use Inertia\Configs\PageConfig;

use function Tempest\env;

return new InertiaConfig(
    // Enforce that page components exist on disk.
    pages: new PageConfig(
        ensure_pages_exist: env('INERTIA_ENSURE_PAGES_EXIST', false),
    ),

    // Enable Laravel's paginator format on the front-end.
    laravel_pagination: true
);
```

Infinite Scrolling
------------------

[](#infinite-scrolling)

A key difference from the Laravel adapter is that **Tempest's paginator is not automatically "request-aware"**. This means you are responsible for retrieving the current page from the request and passing it to your `paginate()` method. The `Inertia::scroll()` method accepts the `pageName` (which defaults to `'page'`) as its second argument. This ensures that the component's state is synchronized with the correct query parameter in the URL.

```
public function index(Request $request): Response
{
    $currentPage = (int) $request->get('users', 1);

    return Inertia::render('Books/Index', [
        'books' => Inertia::scroll(fn() => Book::select()->paginate(currentPage: $currentPage), 'users'),
    ]);

}
```

Server-Side Rendering (SSR)
---------------------------

[](#server-side-rendering-ssr)

To enable SSR, you'll need to configure your front-end build process to generate a server-side bundle.

### Update Vite Configuration

[](#update-vite-configuration)

Modify your `vite.config.js` to handle both client and server builds. The `ssrBuild` flag provided by Vite allows you to conditionally change the configuration.

```
  import tailwindcss from '@tailwindcss/vite'
- import { defineConfig } from 'vite'
+ import { defineConfig, type ConfigEnv } from 'vite'
  import tempest from 'vite-plugin-tempest'
  import vue from '@vitejs/plugin-vue';

- export default defineConfig({
+ export default defineConfig((ConfigEnv) => {
+     const isSsrBuild = configEnv.ssrBuild === true;
+
+     return {
          plugins: [
              tailwindcss(),
              tempest(),
              vue(),
          ],
+         build: {
+             outDir: isSsrBuild ? 'ssr' : 'public/build',
+             manifest: !isSsrBuild ? 'manifest.json' : false,
+             rollupOptions: {
+                 input: isSsrBuild ? 'app/inertia.ssr.ts' : 'app/inertia.entrypoint.ts',
+             },
+         },
+         ssr: {
+             // Add any packages that should be bundled with your SSR build.
+             noExternal: ['@inertiajs/vue3'],
+         },
+     };
  });
```

### Create an SSR Entry Point

[](#create-an-ssr-entry-point)

Create a new file, `app/inertia.ssr.js`, that will serve as the entry point for your Node.js server. This file is responsible for creating the SSR server. Unlike client-side entrypoints, this file should not include `.entrypoint.` in its name. Tempest automatically discovers those for the browser, and this file is meant to stay server-side.

```
- import { createApp, h } from 'vue'
+ import { createSSRApp, h } from 'vue'
import { createInertiaApp } from '@inertiajs/vue3'

void createInertiaApp({
    resolve: name => {
        const pages = import.meta.glob('./**/*.vue')
        return pages[`./${name}.vue`]()
    },
    setup({ el, App, props, plugin }) {
-       createApp({ render: () => h(App, props) })
+       createSSRApp({ render: () => h(App, props) })
            .use(plugin)
            .mount(el)
    },
})
```

React```
import { createInertiaApp } from '@inertiajs/react'
- import { createRoot } from 'react-dom/client'
+ import { hydrateRoot } from 'react-dom/client'

createInertiaApp({
    resolve: name => {
        const pages = import.meta.glob('./**/*.jsx')
        return pages[`./${name}.jsx`]()
    },
    setup({ el, App, props }) {
-       createRoot(el).render()
+       hydrateRoot(el, )
    },
})
```

Svelte```
import { createInertiaApp } from '@inertiajs/svelte'
- import { mount } from 'svelte'
+ import { hydrate, mount } from 'svelte'

createInertiaApp({
    resolve: name => {
        const pages = import.meta.glob('./**/*.svelte')
        return pages[`./${name}.svelte`]()
    },
    setup({ el, App, props }) {
-       mount(App, { target: el, props })
+       if (el.dataset.serverRendered === 'true') {
+           hydrate(App, { target: el, props })
+       } else {
+           mount(App, { target: el, props })
+      }
    },
})
```

### Update Build Script

[](#update-build-script)

Add a build script to your `package.json` that builds both the client and server assets.

```
"scripts": {
    "build": "vite build"
+   "build:ssr": "vite build && vite build --ssr"
},
```

### Enable SSR

[](#enable-ssr)

Finally, enable SSR in your `inertia.config.php` file. The package will automatically discover the `ssr/inertia.ssr.mjs`or `ssr/inertia.ssr.js` bundle. If your bundle is located elsewhere, you must specify the path.

```
use Inertia\Configs\InertiaConfig;
use Inertia\Configs\SsrConfig;

use function Tempest\root_path;

return new InertiaConfig(
    ssr: new SsrConfig(
        enabled: true,
        // bundle: root_path('custom/path/ssr.js'),
    ),
);
```

### Run the Server

[](#run-the-server)

With everything configured, you can now start the SSR server:

```
./tempest inertia:start-ssr
```

For more details, please refer to the official [Inertia.js SSR documentation](https://tempestphp.com/docs/extra-topics/contributing).

Contributing
------------

[](#contributing)

Contributions are welcome. For consistency, follow the patterns and style of [tempestphp/framework](https://tempestphp.com/docs/extra-topics/contributing).

Pull requests should aim for feature parity with [inertia-laravel](https://github.com/inertiajs/inertia-laravel).

###  Health Score

48

—

FairBetter than 93% of packages

Maintenance79

Regular maintenance activity

Popularity24

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 96.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~17 days

Total

20

Last Release

1d ago

Major Versions

v1.2.1 → v2.0.0-beta.12025-10-18

2.x-dev → v3.0.02026-03-25

v3.0.0 → 4.x-dev2026-03-28

v3.0.1 → v4.0.0-beta.12026-05-12

PHP version history (2 changes)v1.0.0PHP ^8.4

v3.0.0PHP ^8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/93f0e340caea2e3c572ace3647368794af943e4c9ad30824865fbd5ff37edf05?d=identicon)[maartendekker](/maintainers/maartendekker)

---

Top Contributors

[![Maarten-Dekker](https://avatars.githubusercontent.com/u/65236304?v=4)](https://github.com/Maarten-Dekker "Maarten-Dekker (77 commits)")[![dcmxyz](https://avatars.githubusercontent.com/u/42419977?v=4)](https://github.com/dcmxyz "dcmxyz (1 commits)")[![laylatichy](https://avatars.githubusercontent.com/u/52243892?v=4)](https://github.com/laylatichy "laylatichy (1 commits)")[![secondmanveran](https://avatars.githubusercontent.com/u/97000801?v=4)](https://github.com/secondmanveran "secondmanveran (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisRector

### Embed Badge

![Health badge](/badges/maartendekker-inertia-tempest/health.svg)

```
[![Health](https://phpackages.com/badges/maartendekker-inertia-tempest/health.svg)](https://phpackages.com/packages/maartendekker-inertia-tempest)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
