PHPackages                             inventor96/inertia-offline - 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. inventor96/inertia-offline

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

inventor96/inertia-offline
==========================

Framework-agnostic backend primitives for Inertia offline support.

v0.2.0(3mo ago)011↓90%1MITPHPPHP &gt;=8.1

Since Apr 3Pushed 3mo agoCompare

[ Source](https://github.com/inventor96/inertia-offline-php)[ Packagist](https://packagist.org/packages/inventor96/inertia-offline)[ RSS](/packages/inventor96-inertia-offline/feed)WikiDiscussions main Synced 4w ago

READMEChangelog (2)DependenciesVersions (3)Used By (1)

inertia-offline (PHP)
=====================

[](#inertia-offline-php)

Framework-agnostic backend primitives for discovering which Inertia routes should be available offline.

> Beta: offline read-only layer for Inertia.js apps, focused on safe cached content and navigation fallback.

This package is intentionally small: it provides the core algorithm and extension points, while each framework (Laravel, Mako, Symfony, Slim, etc.) supplies route inspection, action invocation, and pagination URL expansion.

This PHP backend package is designed to work with [`inertia-offline`](https://github.com/inventor96/inertia-offline-js) (the JS/TS frontend service worker library). Both the frontend and the backend aspects are required for an Inertia.js app.

Why This Exists
---------------

[](#why-this-exists)

Offline-first Inertia apps usually need a server endpoint that returns a list of URLs to precache, often with TTL metadata. The hard part is generating that list in a reliable and maintainable way.

`inventor96/inertia-offline` solves this by:

- Marking cacheable actions with a PHP attribute.
- Scanning routes and reflecting on their actions.
- Expanding dynamic routes via a parameter generator.
- Optionally expanding pagination URLs.
- Returning normalized entries: `{ url, ttl }`.

⚠️ This is (Probably) Not the Package You're Looking For
--------------------------------------------------------

[](#️-this-is-probably-not-the-package-youre-looking-for)

This package is not a drop-in solution for your framework. Instead, it's a core engine that you can build an adapter on top of for your specific framework. Below is a list of known adapters for popular frameworks.

- [`inventor96/inertia-offline-mako`](https://github.com/inventor96/inertia-offline-mako) (Mako framework)

Don't see yours? The core is designed to be adaptable to a wide range of frameworks with different routing and action paradigms. If you build an adapter for a framework, please consider opening a PR to add it to the list below!

Core Concepts
-------------

[](#core-concepts)

### 1. `OfflineCacheable` attribute

[](#1-offlinecacheable-attribute)

The `#[OfflineCacheable(...)]` attribute is used in individual projects on controller methods or functions that should be considered for offline caching.

```
