Download the PHP package lsr/inertia without Composer

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

LSR Inertia

lsr/inertia is a PHP Inertia adapter providing PSR-15 middleware, page rendering, prop helpers and an optional HTTP SSR bridge. It returns JSON for Inertia requests and renders an application-owned HTML template for ordinary requests. It does not provide a JavaScript client, frontend build or SSR server.

Requirements

Installation

Application integration

For applications using Nette DI, register the extension alongside the application's factory, view and normalizer services:

The extension registers Lsr\Inertia\Factory\InertiaFactoryInterface and Lsr\Inertia\Middleware\InertiaMiddleware. Add the middleware to the application's actual PSR-15 pipeline before handlers that render Inertia pages; registering a service alone does not install it in a pipeline.

The middleware puts a request-specific Lsr\Inertia\Services\Inertia instance in the request attribute inertia. In a handler receiving that decorated request:

The application must supply the Welcome frontend component and the root template. The default template name is pages/index; the fourth render() argument selects another template. render() returns a PSR response, leaving emission to the application.

Alternatively, inject InertiaFactoryInterface and call fromRequest($request). Each call creates a new service, so changes to one instance, including its public version property, do not carry over to another. The optional WithInertia controller trait expects $request, $params and an injected factory; it uses this factory path.

Root template and protocol behavior

The view receives inertiaPage, inertiaHead and inertiaBody in addition to the supplied template parameters. Insert the generated head and body HTML without double-escaping, using the rendering engine's trusted-HTML mechanism. Escape any unrelated application content normally.

The client-rendered fallback body contains a JSON <script data-page="app" type="application/json"> followed by <div id="app"></div> (with the configured root ID). This is the adapter's current V3-style bootstrap, not the older root data-page attribute format; align the JavaScript client with it. SSR HTML comes from the configured renderer and must be trusted.

render() emits Vary: X-Inertia for HTML and JSON responses. For Inertia requests, middleware also handles asset-version mismatches on GET with a 409 location response and changes 302 redirects after PUT/PATCH/DELETE to 303. To enable version checks, set version on the same middleware-created instance before returning the response.

Prop helpers include lazy(), always(), defer(), merge(), deepMerge() and once(). Partial reload and prop metadata handling live in service tests for their specific options and request-header behavior.

Optional server-side rendering

SSR is disabled by default. With the required client and factory services available:

ssrHttpClient is an application-owned PSR-18 client; configure its timeouts in that service. If client is omitted, DI must resolve an autowired client. Use a trusted, application-configured HTTP(S) URL, never a URL supplied by a request.

The bridge POSTs the normalized page JSON and accepts JSON containing head (a list of HTML strings) and body (a nonempty HTML string), or JSON null to decline rendering. The returned body must include the client bootstrap and populated root. SSR runs only for non-Inertia GET renders; the request attribute Inertia::SSR_ENABLED_ATTRIBUTE set to false disables it for that request. Recognized SSR failures fall back to client rendering unless throwOnError is enabled.

See HttpRenderer for the exact integration boundaries.

Development

CI runs the checks below on PHP 8.4 and 8.5. From a package checkout:

composer cs checks coding style without changing files. Run composer cs:fix (or composer cbf) to apply PHP CS Fixer rules from .php-cs-fixer.php.

The suite uses Nyholm PSR-7, Nette DI and Latte development dependencies and does not need an SSR server. Install the DOM, mbstring, XML and XMLWriter extensions for PHPUnit. The composer test script enables Xdebug coverage; the CI command explicitly disables coverage collection.

AI coding assistance

See LSR Skills for AI agent skills for working with the LSR framework.

License

Licensed under the MIT License.


All versions of inertia with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
psr/http-client Version ^1
psr/http-factory Version ^1
psr/http-message Version ^1|^2
psr/http-server-middleware Version ^1
lsr/interfaces Version ^0.3.16
symfony/serializer Version ^8|^7|^6
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 lsr/inertia contains the following files

Loading the files please wait ...