PHPackages                             jessegall/inertia-static-props - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. jessegall/inertia-static-props

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

jessegall/inertia-static-props
==============================

v1.5.5(9mo ago)05.2k↑18.8%1MITPHPPHP ^8.2

Since Feb 28Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/jessegall/inertia-static-props)[ Packagist](https://packagist.org/packages/jessegall/inertia-static-props)[ RSS](/packages/jessegall-inertia-static-props/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (3)Versions (32)Used By (0)

Inertia Static Props
====================

[](#inertia-static-props)

> **Deprecated:** This package is no longer maintained. Inertia.js v2 now includes native support for this functionality through "Once Props". Please use the official implementation instead:

*Optimize Inertia.js applications by loading static data only during the first page load.*

[![Latest Version on Packagist](https://camo.githubusercontent.com/16b02e955c575b9899f6f416a7520f7558cdb8b57f57539b15bdeef2c22e593b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6573736567616c6c2f696e65727469612d7374617469632d70726f70732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jessegall/inertia-static-props)[![Total Downloads](https://camo.githubusercontent.com/b6428d641a3c28de8104715b02c78fb77dd7cd822733a3a0f0223870bfdf765e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6573736567616c6c2f696e65727469612d7374617469632d70726f70732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jessegall/inertia-static-props)

A Laravel package that improves performance by caching static data on the client side, reducing payload sizes and processing time for subsequent requests.

Table of Contents
-----------------

[](#table-of-contents)

1. [Introduction](#introduction)
2. [Installation](#installation)
3. [Usage](#usage)
4. [Manually Refreshing Static Props](#manually-refreshing-static-props)
5. [Adding Static Props to Component Renders](#adding-static-props-to-component-renders)
6. [How It Works](#how-it-works)
7. [License](#license)

Introduction
------------

[](#introduction)

Inertia Static Props optimizes your Inertia.js application by loading static data only once during the initial page load. After that, static props are cached in the frontend and injected into the page props on every subsequent visit.

By using static props, you can significantly reduce the payload size and processing time for subsequent requests, leading to improved performance.

Installation
------------

[](#installation)

The package consists of two parts: a Laravel backend package and a frontend adapter.

### Backend

[](#backend)

Install the package via Composer:

```
composer require jessegall/inertia-static-props
```

The package will auto-register its service provider if you're using Laravel's package auto-discovery.

Otherwise, you can manually register the service provider:

```
\JesseGall\InertiaStaticProps\ServiceProvider::class
```

### Frontend

[](#frontend)

1. Install the frontend adapter via npm:

```
npm i inertia-static-props
```

2. Set up the plugin in your Inertia application:

```
// Import the plugin
import {inertiaStaticPropsPlugin} from "inertia-static-props";

createInertiaApp({
    setup({el, App, props, plugin}) {
        createApp({render: () => h(App, props)})
            .use(plugin)
            // Add other plugins...
            .use(inertiaStaticPropsPlugin) // Register the static props plugin
            .mount(el);
    },
});
```

Usage
-----

[](#usage)

You can share static props from anywhere in your application.

The most common place is in your `HandleInertiaRequests` middleware, but this is not required:

```
use JesseGall\InertiaStaticProps\StaticProp;
use Inertia\Inertia;

class HandleInertiaRequests extends Middleware
{
    public function share(Request $request): array
    {
        return [
            ...parent::share($request),

            // Using a StaticProp instance
            'translations' => new StaticProp(fn() => $this->resolveTranslations()),

            // Using the Inertia helper
            'enums' => Inertia::static(fn() => $this->resolveEnums()),
        ];
    }
}
```

The shared static props will always be available in the page props.

```
// In your page components

    const props = defineProps([
        'translations',
        'enums'
    ])

// Using the page helper

    import {usePage} from "@inertiajs/vue3";

    const page = usePage();
    page.props.translations;
    page.props.enums;

// Or in the template

        {{ $page.props.translations }}
        {{ $page.props.enums }}

```

Thats it! The static props will be cached in the frontend and injected into the page props on every subsequent visit.

Manually Refreshing Static Props
--------------------------------

[](#manually-refreshing-static-props)

Sometimes you need to refresh static props after certain actions, like changing the users locale, or when the user permissions change.

```
class LocaleController extends Controller
{
    public function update(...)
    {
        // Something that requires a static prop refresh
        ...

        // Reload all static props
        Inertia::reloadStaticProps();
    }
}
```

Adding Static Props to Component Renders
----------------------------------------

[](#adding-static-props-to-component-renders)

Though, not recommended, it is possible to include static props when rendering components.

```
return Inertia::render('Component', [
    'regularProp' => 'value',
    'staticPropExample' => new StaticProp(fn() => 'static value'),
]);
```

Warning

Static props are only sent to the client during the initial page load.

When your controller is accessed after the initial page load, you'll need to reload the static props to ensure the static props are sent to the client.

```
return Inertia::render(...)->withStaticProps(); // Add static props to the response
```

How It Works
------------

[](#how-it-works)

Behind the scenes, the package:

1. Identifies props wrapped in `StaticProp` during the initial page load
2. Evaluates these props and sends them to the client
3. Caches them in the frontend (browser)
4. On subsequent requests, these props will NOT be resolved on the server and are removed from the response.
5. The client-side adapter injects the cached props back into the page props before Inertia processes them, creating a seamless experience as if the server had sent them.

This results in smaller payloads and reduced server processing time for subsequent requests.

License
-------

[](#license)

MIT

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance65

Regular maintenance activity

Popularity25

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 97.7% 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 ~5 days

Total

31

Last Release

291d ago

Major Versions

v0.2.2 → v1.0.02025-03-13

PHP version history (3 changes)v0.0.2PHP ^8.1.0

v0.2.0PHP ^8.4

v1.3.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a13b52a17e71644445ec3597dc1c8faf54ebd8b6b087e219c672aae06ac5332?d=identicon)[JesseGall](/maintainers/JesseGall)

---

Top Contributors

[![jessegall](https://avatars.githubusercontent.com/u/11755417?v=4)](https://github.com/jessegall "jessegall (84 commits)")[![RedmarBakker](https://avatars.githubusercontent.com/u/15876733?v=4)](https://github.com/RedmarBakker "RedmarBakker (2 commits)")

---

Tags

inertiajslaravelpropsstaticvue3

### Embed Badge

![Health badge](/badges/jessegall-inertia-static-props/health.svg)

```
[![Health](https://phpackages.com/badges/jessegall-inertia-static-props/health.svg)](https://phpackages.com/packages/jessegall-inertia-static-props)
```

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4205.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)[emargareten/inertia-modal

Inertia Modal is a Laravel package that lets you implement backend-driven modal dialogs for Inertia apps.

88103.7k](/packages/emargareten-inertia-modal)

PHPackages © 2026

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