Download the PHP package leon-wbr/inertia-typo3 without Composer

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

Status: before 1.0. v0.1.0 is on Packagist. The adapter implements the Inertia 3 protocol and is tested against the official React, Vue and Svelte clients, but its PHP API can still change between minor releases until 1.0. Compared with inertia-laravel lists what is missing. Feedback and issues are welcome.

TYPO3 Inertia Adapter

A TYPO3 extension providing the server side of Inertia.js 3: TYPO3 keeps routing, languages, access, redirects and the page cache, and answers with Inertia page objects that a React, Vue or Svelte frontend renders.

It follows the official inertia-laravel 3.x adapter where TYPO3 allows.

Contents:

Features

Requirements

Version
TYPO3 14.3
PHP 8.2 to 8.5
Inertia.js client 3.x

TYPO3 13.4 is no longer supported; the earlier 13.4 proof of concept stays in the git history.

Quickstart with DDEV

The repository contains a runnable example project in example/packages/sitepackage with a React 19 frontend, an English and a German page tree, and the verification suite.

The backend is at /typo3 (user admin, password Password1!).

For frontend work, run the Vite dev server instead of the build. Start it from example/, because ddev vite runs in the matching directory inside the container:

While it runs, it writes example/var/vite-dev-server, and TYPO3 loads assets from the dev server with hot module replacement; flush the TYPO3 caches (ddev exec -d /var/www/html/example vendor/bin/typo3 cache:flush) for already cached pages. Stop it (Ctrl+C) and TYPO3 serves the production build again. If the dev server crashed instead, delete example/var/vite-dev-server yourself.

The DDEV project runs PHP 8.5, MariaDB 10.11 and Node.js 26 (LTS) with pnpm 12, and needs DDEV 1.25 or later.

Verification

runs everything from scratch and exits non-zero on the first failure:

  1. composer install, pnpm install, a fresh database, typo3 setup and the example content;
  2. composer validate, PHP CS Fixer and PHPStan (level 9, with a baseline of the errors that existed when the level was raised);
  3. PHPUnit unit and functional tests (TYPO3 testing framework, SQLite), and the unit tests again with pcov, failing below the minimum line coverage set in example/composer.json, then mutation testing of the middleware, props and services with Infection (composer test:mutation in example/), failing below the minimum MSI in Build/phpunit/infection.json5;
  4. the Inertia parity check: the protocol surface in Build/Parity/parity.json against the installed @inertiajs/core (see TODO.md);
  5. ESLint, Prettier and the TypeScript 7 typecheck;
  6. a Vite production build;
  7. Playwright end-to-end tests against the site serving that build: first load, Inertia navigation, asset version mismatch, form redirects with validation errors and flash data, query strings, partial reloads, deferred, optional, merge and once props, infinite scroll, and the second language.

GitHub Actions runs the same command on pushes to main and on pull requests. ddev outdated lists outdated Composer and pnpm dependencies of the example.

For the PHP part alone, run composer check in example/ (code style, PHPStan and both test suites, without DDEV once composer install has run there), or one of composer cs, cs:fix, stan, test:unit, test:functional and test:coverage (needs pcov or Xdebug).

Conformance with the official clients

runs the official Inertia clients, @inertiajs/react, @inertiajs/vue3 and @inertiajs/svelte, against a TYPO3 project of their own with this adapter. Every case of the protocol conformance list is a test, and known gaps are expected failures. After a run, the case × client matrix is in conformance/matrix.md. GitHub Actions runs it on every branch push and shows the matrix in the job summary. See conformance/README.md.

Installation in your own project

The root view below loads the frontend with praetorius/vite-asset-collector, as the example does. The adapter doesn't require it, so install it too if you want the same setup:

Any other way of adding your script and style tags works as well. Then point the extension setting manifestPath at your build's manifest (see Settings), because its hash is the asset version.

Then:

  1. Add the site set leon-wbr/inertia to your site (or a sitepackage set that depends on it). It renders every page through the page plugin.
  2. Provide a root view: a Fluid template App.html in a path you add to plugin.tx_inertia.view.templateRootPaths. It renders the page element and your entry point:

  3. Set up the client. For React:

    TYPO3 pages render the component Default (see main.tsx is a complete entry point.

Starting from the example sitepackage

example/packages/sitepackage is the example's sitepackage and a complete starter: the root view, shared props (site, languages, navigation), page components chosen by frontend layout, content elements rendered by React or from TYPO3's HTML, and a contact form. To start your own project from it:

  1. Copy example/packages/sitepackage into your project's packages/ directory, and rename the Composer package, the extension key and the PHP namespace if you like.
  2. Add a path repository for it and require it:

  3. Add its site set leon-wbr/inertia-sitepackage to your site. It pulls in the adapter's set and fluid_styled_content.
  4. Build the frontend in your project root, as the example does: copy example/package.json, example/vite.config.ts, example/tsconfig.json and example/eslint.config.js (drop the Playwright parts you don't need), then pnpm install and pnpm build.

See the sitepackage README for what it contains.

Usage

Shared props

Replace the adapter's middleware with your own subclass, registered under the same identifier in your extension's Configuration/RequestMiddlewares.php:

Page component and props

Pages render the component from the site setting inertia.component (default Default) with the props title and contentElements. Listen to BeforeInertiaPageRenderedEvent to pick another component or add props:

In your own Extbase controllers or middlewares, use InertiaService directly: render(), location(), redirect(), share(), shareOnce(), always(), optional(), defer(), merge(), deepMerge(), once(), scroll(), withErrors(), flash(), encryptHistory() and clearHistory().

Forms and validation errors

Handle the submission, flash the errors and redirect back. The errors are stored in the TYPO3 frontend user session, which works for anonymous visitors too (TYPO3 sets its session cookie once something is stored), and arrive on the next page as the errors prop:

The example's contact form works this way.

Flash data

$this->inertia->flash('success', 'Saved') (or an array) stores data for the next page the client renders. As in inertia-laravel 3.x, it is sent as the page object's flash key, not as a prop: read it with usePage().flash, or router.on('flash', …) for toasts. It is sent once and then cleared. Type it with flashDataType in InertiaConfig.

Once props

A once prop is resolved once and then kept by the client: on later visits the client lists the once props it has in X-Inertia-Except-Once-Props, and the server skips them.

Infinite scroll

scroll() makes a prop for <InfiniteScroll>. The page announces it in scrollProps (page name, previous, next and current page), and each page the client loads is appended to the items, or prepended when it scrolls up (X-Inertia-Infinite-Scroll-Merge-Intent).

Testing

LeonWbr\Inertia\Testing\InteractsWithInertia is a trait for functional tests with typo3/testing-framework, like inertia-laravel's assertInertia():

Settings

Site setting Default
inertia.component Default Page component for TYPO3 pages
inertia.contentElements.typedTypes none CTypes your frontend renders itself; their HTML fallback is skipped
inertia.contentElements.properties common tt_content fields Fields sent as data; empty sends all

The extension setting manifestPath (default _assets/vite/.vite/manifest.json) is the file whose hash is the asset version.

Compared with inertia-laravel

The adapter follows inertia-laravel 3.x, the reference server adapter. TODO.md has the full audit against the latest Inertia releases: every feature with its source, status, tests and priority, the next steps, and how the list is kept in sync.

Feature inertia-laravel 3.x This adapter
Page object, JSON responses, <script> page element ✓ ✓
Asset versioning (409 + X-Inertia-Location) ✓ ✓ (hash of the Vite manifest)
303 after PUT, PATCH, DELETE; fragment redirects ✓ ✓
External redirects (Inertia::location()) ✓ ✓ location()
Shared props, lazy closures, dot keys ✓ ✓
Partial reloads (only, except, nested paths) ✓ ✓
Always, optional, deferred props (groups) ✓ ✓
Merge, prepend, deep merge, matchOn ✓ ✓
Once props (once(), as(), until(), fresh(), shareOnce()) ✓ ✓
Scroll props for <InfiniteScroll> ✓ (Laravel paginators) ✓ (TYPO3 paginators, arrays)
Validation errors, error bags, withAllErrors ✓ (Laravel session) ✓ (TYPO3 frontend session)
Flash data (page flash) ✓ ✓
History encryption and clearing ✓ (also as middleware) ✓ (flags on InertiaService)
Testing assertions ✓ assertInertia() ✓ InteractsWithInertia, AssertableInertia
Reloads and deferred props in testing assertions (reloadOnly(), loadDeferredProps()) ✓ – build them with inertiaReloadRequest()
Server-side rendering ✓ – planned
Live props (broadcasting) ✓ –
Rescued deferred props (rescue) ✓ –
ProvidesInertiaProperties, Arrayable and Responsable props ✓ – (JsonSerializable works)
BigInt preservation, preserveFragment across redirects ✓ –
Precognition ✓ –
Dev tools ✓ –
Component existence check in tests ✓ –

Roadmap

Support

Questions and ideas go to GitHub Discussions, bugs to GitHub Issues.

Contributing

See the Contributing Guidelines. Run ddev verify before opening a pull request.

License

This project is licensed under the GNU General Public License v3.0 or later (GPL-3.0-or-later). See the LICENSE file for details.


All versions of inertia-typo3 with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
typo3/cms-core Version ^14.3.10
typo3/cms-extbase Version ^14.3.10
typo3/cms-fluid Version ^14.3.10
typo3/cms-frontend Version ^14.3.10
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 leon-wbr/inertia-typo3 contains the following files

Loading the files please wait ...