Download the PHP package jessegall/inertia-static-props without Composer

On this page you can find all versions of the php package jessegall/inertia-static-props. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package inertia-static-props

Inertia Static Props

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

Latest Version on Packagist Total Downloads

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

  1. Introduction
  2. Installation
  3. Usage
  4. Manually Refreshing Static Props
  5. Adding Static Props to Component Renders
  6. How It Works
  7. License

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

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

Backend

Install the package via Composer:

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:

Frontend

  1. Install the frontend adapter via npm:

  2. Set up the plugin in your Inertia application:

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:

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

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

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

Adding Static Props to Component Renders

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

[!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.

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

MIT


All versions of inertia-static-props with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version ^10.0|^11.0|^12.0
inertiajs/inertia-laravel Version ^2.0
php Version ^8.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jessegall/inertia-static-props contains the following files

Loading the files please wait ....