PHPackages                             onix-systems-php/hyperf-inertia - 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. onix-systems-php/hyperf-inertia

ActiveExtention

onix-systems-php/hyperf-inertia
===============================

The Hyperf adapter for Inertia.js.

v1.0.9(1y ago)3173↓100%[1 issues](https://github.com/onix-systems-php/hyperf-inertia/issues)MITPHPPHP &gt;=8.1

Since Mar 19Pushed 1y ago3 watchersCompare

[ Source](https://github.com/onix-systems-php/hyperf-inertia)[ Packagist](https://packagist.org/packages/onix-systems-php/hyperf-inertia)[ RSS](/packages/onix-systems-php-hyperf-inertia/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (13)Versions (14)Used By (0)

Inertia.js Hyperf Adapter
=========================

[](#inertiajs-hyperf-adapter)

---

Visit [inertiajs.com](https://inertiajs.com/) to learn more.

Todo
====

[](#todo)

- Programmatically initialize node\_modules.

Installation
------------

[](#installation)

- `composer require onix-systems-php/hyperf-inertia` require package.
- ` php ./bin/hyperf.php vendor:publish  onix-systems-php/hyperf-inertia` publish config and middleware from package.
- `npm init` init package.json if not exist
- `php ./bin/hyperf.php inertia:init ` Initialize inertia.
- Add commands to the package.json ```
    "scripts": {
      "dev": "vite",
      "build": "vite build",
      "build-ssr": "vite build && vite build --ssr" (optional)
    },
    ```
- `npm i` install node\_modules packages
- Run inertia:
    - `npm run dev` for development
    - `npm run build` for production

> **Note**If you use Svelte, package.json type must be module. `"type": "module"`

Middleware
----------

[](#middleware)

Next we need to setup the Inertia middleware, in file `./config/middlewares.php` . You can accomplish this by publishing the HandleInertiaMiddleware middleware to your application.

> **Note**This middleware must be placed before the `validation` middleware.

```
'http' => [
      \App\Common\Middleware\HandleInertiaMiddleware::class,
  ],
```

Creating responses
------------------

[](#creating-responses)

```
    #[GetMapping(path: '/test-feedback')]
    public function test(RequestInterface $request)
    {
        return inertia('Test', [
            'title' => 'Feedback form',
            'formTitle' => "What's on your mind?"
        ])->toResponse($request);
    }
```

```
    #[PostMapping('/test-feedback')]
    public function testFeedback(RequestInterface $request)
    {
        $rules = [
            'fullname' => 'required|string|min:3|max:255',
            'email' => 'required|email',
            'message' => 'required|string|min:10|max:255',
        ];

        $validator = $this->validationFactory->make($request->all(), $rules);
        $validator->validate();

        return redirect_with('test-feedback', [
            'alert' => [
                'message' => 'Feedback was successfully sent',
                'type' => 'success',
            ],
        ]);
    }
```

Frontend Part
-------------

[](#frontend-part)

After executing `php ./bin/hyperf.php inertia:init` you will get the folder structure.

```
.
├── storage
│   ├── inertia
│   │    ├── css
│   │    │  └── app.css
│   │    └── js
│   │       ├── Components
│   │       ├── Layouts
│   │       ├── Pages
│   │       ├── app.js
│   │       ├── sst.js (optional)
│   │       └── bootstrap.js
│   ├── view
│   │    └── layouts
│   │       └── app.blade.php
│   └── ...
├── vite.config.json
└── ...

```

In folders `Components`, `Layouts`, `Pages` you can create your own components, layouts and pages.

### Ssr

[](#ssr)

In the `./bin/hyperf.php inertia:init` process, you can select ssr. If you have set ssr separately, you can copy this file from `hyperf-inertia/src/Commands/Stubs/{your_framework}/ssr.{ext}`Or read the [inertia](https://inertiajs.com/server-side-rendering) documentation .

How to run ssr
--------------

[](#how-to-run-ssr)

- `npm run build-ssr`
- `php ./bin/hyperf.php inertia:start-ssr` into container run command to start ssr server.

Environment variables
---------------------

[](#environment-variables)

- `INERTIA_SSR_ENABLED` - If you are using ssr, set to true. By default false.
- `INERTIA_SSR_URL` - URL of the ssr server. By default .
- `INERTIA_IS_SECURE` - If you are using http, set to false. By default true.
- `INERTIA_SKIP_URL_PREFIX` - If you need to skip url, set to prefix. Prefixes should be specified as a string using the separator `,`. By default empty string. Example `v1,api`. All requests starting with this prefix will be skipped in inertia.
- `INERTIA_NO_SKIP_EXTRA_PATH` When prefix exist in to `INERTIA_SKIP_URL_PREFIX`, but an exception must be made for a separate path. The extra path should be specified as a string using the separator `,`. By default empty string. Example `admin/login,admin/forgot`.

Examples of frontend files
--------------------------

[](#examples-of-frontend-files)

In the package you can find example files for the frontend. vendor/onix-systems-php/hyperf-inertia/example There is also an example controller here.

- It is necessary to connect styles in inertia.blade.php ``

> **Note**If you are using arm64, you need to add `@rollup/rollup-darwin-arm64`, this is only for svelte

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~14 days

Recently: every ~6 days

Total

9

Last Release

667d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8e1c2e991197c9603eb160eb27e1be423eb683ee2eed293288993936444c20bb?d=identicon)[onix-systems-php](/maintainers/onix-systems-php)

---

Top Contributors

[![dbekeshenkoix](https://avatars.githubusercontent.com/u/75316290?v=4)](https://github.com/dbekeshenkoix "dbekeshenkoix (14 commits)")[![vmikhav](https://avatars.githubusercontent.com/u/11061723?v=4)](https://github.com/vmikhav "vmikhav (4 commits)")[![harryqt](https://avatars.githubusercontent.com/u/18257605?v=4)](https://github.com/harryqt "harryqt (2 commits)")

---

Tags

inertiahyperf

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/onix-systems-php-hyperf-inertia/health.svg)

```
[![Health](https://phpackages.com/badges/onix-systems-php-hyperf-inertia/health.svg)](https://phpackages.com/packages/onix-systems-php-hyperf-inertia)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
