Download the PHP package inventor96/inertia-offline without Composer

On this page you can find all versions of the php package inventor96/inertia-offline. 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-offline

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 (the JS/TS frontend service worker library). Both the frontend and the backend aspects are required for an Inertia.js app.

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:

⚠️ This is (Probably) Not the Package You're 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.

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

1. OfflineCacheable attribute

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

Attribute options:

2. AbstractOfflineRouteList

This abstract class contains the full generation pipeline (generateRoutes()):

  1. Iterate framework routes (getRoutes()).
  2. Resolve each route action (getRouteAction()), normalize format, and build reflection.
  3. Keep routes whose reflected action has #[OfflineCacheable].
  4. Evaluate access_control when configured.
  5. Build URL entries:
    • Single URL from route pattern, or
    • Multiple URLs from param_generator.
  6. Expand paginated URLs when pagination_resolver is configured.
  7. Deduplicate and return array{ array{url: string, ttl: int} }.

3. Action normalization and supported action types

The core supports common action formats:

If reflection or invocation is not possible for an action, that route is skipped.

4. URL building strategy

Route URL creation is done from a route pattern and parameter set:

Contracts

Built-in Implementations

QueryPaginationUrlExpander

A ready-to-use implementation of PaginationUrlExpanderInterface that generates paginated URLs by appending a configurable query parameter (e.g. ?page=2) to the base URL.

It resolves page count from the value returned by pagination_resolver in three ways:

Resolver return type Resolution strategy
int Used directly as the page count.
Object with numberOfPages() method Calls numberOfPages() and casts to int.
Array with 'pages' key Reads $pagination['pages'] and casts to int.

Given a base URL and a resolved page count n, it produces URLs for pages 1 through n.

Usage in an adapter

This expander is intentionally framework-agnostic, so it can serve as the default in any adapter. It's recommended that adapters accept an optional PaginationUrlExpanderInterface argument and fall back to QueryPaginationUrlExpander when none is provided, allowing projects to inject their own expander:

This pattern lets the adapter provide a sensible default while giving individual projects the flexibility to substitute a custom expander for pagination schemes that use path segments, cursor tokens, or other non-standard formats.

If your framework has a DI container, you can also consider making the expander a dependency of the adapter and letting projects bind their preferred implementation in the container.

Building a Framework Adapter

To implement this package for your framework, create a class extending AbstractOfflineRouteList and implement the abstract methods.

Recommended Adapter Methodology

  1. Route selection

    • Return all routes from your framework's router in getRoutes().
    • Let the core filter down to cacheable routes via the presence of #[OfflineCacheable] in individual projects.
  2. Stable action invocation

    • Ensure invokeAction() can call class methods, closures, and container-resolved callables.
  3. Pagination normalization

    • Treat pagination resolver output as adapter-specific and convert to URLs via one expander implementation.
    • Feel free to use QueryPaginationUrlExpander as the default inside expandPaginationUrls() if it covers the common case for your framework.
    • Accept an optional PaginationUrlExpanderInterface in your adapter constructor so projects can supply a custom expander for non-standard pagination (path-segment pages, cursor tokens, etc.).
  4. Observability

    • Implement logWarning() so unsupported actions or malformed generators are visible in logs.
  5. Deterministic output

    • Keep route generation deterministic for the same user/context to improve cache behavior and debugging.
  6. ETag support (optional)
    • The frontend library supports the use of ETags and If-None-Match headers for caching the route list and inertia requests. If your framework does not have built-in support for ETags, consider implementing a simple ETag middleware that projects can use.

Example: Dynamic Route + Pagination

Possible flow:

(all with configured TTL of 1800 seconds)

Package Boundaries

This package does not:

Those concerns belong in your framework adapter or host application.


All versions of inertia-offline with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
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 inventor96/inertia-offline contains the following files

Loading the files please wait ...