Download the PHP package crenspire/yii2-inertia without Composer

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

Yii2 Inertia.js Adapter

CI

An Inertia.js adapter for Yii2 framework, providing a seamless bridge between your Yii2 backend and modern JavaScript frontend frameworks (React, Vue, Svelte).

Features

Installation

Install via Composer:

Quick Start

1. Configure Your Application

In your config/web.php, register the Inertia view renderer:

2. Create Root View Template

Create a root view template at views/layouts/inertia.php:

3. Use in Controllers

4. Setup Frontend

Install Inertia.js and your frontend framework:

Create src/main.jsx:

API Reference

Inertia::render()

Render an Inertia page:

Inertia::share()

Share data with all Inertia responses:

Inertia::version()

Set or get the asset version:

Inertia::location()

Create an Inertia redirect response:

Global Helper

You can also use the global inertia() helper function:

Partial Reloads

Inertia supports partial reloads for better performance. The client can request only specific props:

Redirects

For POST/PUT/PATCH/DELETE requests, Inertia handles redirects automatically:

The Inertia::location() method automatically detects the request type:

Version Management

Inertia.js uses version checking to ensure the frontend and backend stay in sync. When the client's version doesn't match the server's version, a full page reload is triggered.

Automatic Version Detection

By default, the version is automatically detected from your manifest.json file:

Custom Version

You can set a custom version:

Version Mismatch Handling

When a client sends an X-Inertia-Version header that doesn't match the current version, the adapter automatically returns a location redirect (409 status) to trigger a full page reload. This ensures users always have the latest assets.

Configuration

Root View Path

You can configure the root view path:

Bootstrap/Initialization

For shared props that should be available on every page, you can set them in your application bootstrap or a common controller:

Troubleshooting

Version Mismatch Issues

If you're experiencing frequent full page reloads, check:

  1. Your version callback is returning a stable value
  2. The manifest.json file exists and is accessible
  3. File permissions allow reading the manifest file

Redirect Not Working

If redirects aren't working as expected:

  1. Ensure you're using Inertia::location() instead of Yii's redirect()
  2. Check that the request has the X-Inertia header for Inertia requests
  3. Verify the response status code (409 for Inertia, 302 for regular)

Root View Not Found

If you get "Root view file not found" errors:

  1. Verify the path in Inertia::setRootView() is correct
  2. Check that the view file exists and is readable
  3. Ensure Yii aliases are properly configured

Running the Example

The repository includes a complete example application. To run it:

Visit http://localhost:8000 in your browser.

Testing

Run the test suite:

Requirements

License

MIT License. See LICENSE file for details.

Contributing

Please see CONTRIBUTING.md for details.

Changelog

See CHANGELOG.md for a list of changes.


All versions of yii2-inertia with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
yiisoft/yii2 Version ~2.0.50
ext-json Version *
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 crenspire/yii2-inertia contains the following files

Loading the files please wait ...